You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
this was my clanker trying out things, I have not looked at it yet, just wanted CI to run.
Description
This draft prototypes a max_align_t-sized allocation prefix for PHP 8.4+ heap-live profiling. Allocation hooks are installed during GINIT in passthrough mode and switch to prefixed pointers only after a clean non-full ZendMM reset, allowing malloc, realloc, and free to translate pointers without mixing pre-epoch and post-epoch allocations. Using the allocator's maximum alignment for the prefix preserves the alignment of returned pointers, including x86 SIMD-sensitive allocations.
The startup thread uses PHP's existing module-startup reset. Later ZTS threads use a chained TSRM new-thread-end handler that mirrors PHP startup's virtual-CWD cleanup around a non-full reset, establishing the epoch before the first request in ext-parallel, FrankenPHP, and Apache mod_event workers. Request flags gate sampling and heap-live tracking while pointer translation remains installed until GSHUTDOWN, where previous allocator handlers are restored before profiler TLS is destroyed. Neighboring custom allocators and USE_ZEND_ALLOC=0 remain in passthrough mode.
The prefix contains a magic value so an invariant violation aborts instead of forwarding a relocated pointer to ZendMM. The PR also documents allocation-footer and ZendMM chunk-map fallback designs that preserve pointers if the clean-epoch mechanism is not suitable for production.
Known PoC risks: TSRM exposes a singleton new-thread handler rather than an observer list, the callback runs while TSRM's mutex is held, and this draft intentionally leaves the process-global handler installed for the process lifetime. These need resolution before treating this as production-ready.
Comparing candidate commit 4fdfcd5 in PR branch florian/no-jira-heap-live-prefix-poc with baseline commit 024fe4a in branch master.
Found 0 performance improvements and 0 performance regressions! Performance is the same for 28 metrics, 8 unstable metrics.
Explanation
This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:
🟩 = significantly better candidate vs. baseline
🟥 = significantly worse candidate vs. baseline
We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.
If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.
Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.
More details about the CI and significant changes
You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.
CIs of the difference of means are often centered around 0%, because often changes are not that big:
---------------------------------(------|---^--------)-------------------------------->
-0.6% 0% 0.3% +1.2%
| | |
lower bound of the CI --' | |
sample mean (center of the CI) -------------' |
upper bound of the CI ----------------------'
As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).
For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:
----------------------------------------|---------|---(---------^---------)---------->
0% 1% 1.3% 2.2% 3.1%
| | | |
significant impact threshold --------------' | | |
lower bound of CI --------------' | |
sample mean (center of the CI) --------------------------' |
upper bound of CI ----------------------------------'
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
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.
Note
this was my clanker trying out things, I have not looked at it yet, just wanted CI to run.
Description
This draft prototypes a
max_align_t-sized allocation prefix for PHP 8.4+ heap-live profiling. Allocation hooks are installed during GINIT in passthrough mode and switch to prefixed pointers only after a clean non-full ZendMM reset, allowing malloc, realloc, and free to translate pointers without mixing pre-epoch and post-epoch allocations. Using the allocator's maximum alignment for the prefix preserves the alignment of returned pointers, including x86 SIMD-sensitive allocations.The startup thread uses PHP's existing module-startup reset. Later ZTS threads use a chained TSRM new-thread-end handler that mirrors PHP startup's virtual-CWD cleanup around a non-full reset, establishing the epoch before the first request in ext-parallel, FrankenPHP, and Apache mod_event workers. Request flags gate sampling and heap-live tracking while pointer translation remains installed until GSHUTDOWN, where previous allocator handlers are restored before profiler TLS is destroyed. Neighboring custom allocators and USE_ZEND_ALLOC=0 remain in passthrough mode.
The prefix contains a magic value so an invariant violation aborts instead of forwarding a relocated pointer to ZendMM. The PR also documents allocation-footer and ZendMM chunk-map fallback designs that preserve pointers if the clean-epoch mechanism is not suitable for production.
Known PoC risks: TSRM exposes a singleton new-thread handler rather than an observer list, the callback runs while TSRM's mutex is held, and this draft intentionally leaves the process-global handler installed for the process lifetime. These need resolution before treating this as production-ready.
Validation performed:
xxhash_seed.phpt.Reviewer checklist