Open
Conversation
Multi-process architecture with 8 workers using pcntl_fork, each parsing newline-aligned file chunks via fread 8MB buffers. Key optimizations: integer date keys (YYYYMMDD) for 57% faster hash lookups during merge, zero-copy leftover handling across buffers, 2x loop unrolling, reference-based merge, igbinary when available. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Single-core solution with fread 8MB buffers, integer date keys (YYYYMMDD) for faster hash lookups, zero-copy leftover handling, 2x loop unrolling, and inlined offset math. No pcntl_fork or multi-process logic. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Member
|
Benchmarking complete! Mean execution time: 33.11506546938s |
Replace nested hash table ($data[$path][$date]++) with flat integer array ($counts[slugBase + dateId]++) for O(1) packed array access. Key optimizations: - Pre-computed slug->ID and date->ID mappings from Visit::all() - 8-char date keys (YY-MM-DD) for faster hash lookups - Comma search with fixed 52-char jump (skip domain+timestamp) - Eliminates per-path inner hash table overhead Benchmarked 2x faster parsing (3.4s vs 7.5s on 10M rows). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Author
|
/bench |
Member
|
Benchmarking complete! Mean execution time: 17.8358065843s |
Member
|
Mean time? More like meme time. You're cooking. 🍳 |
Member
|
You just made the CPU do less cardio. 🫀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Test plan
php tempest data:validatepasses/bench