Repository navigation
Optimize serialize - #23110
Optimize serialize#23110kamil-tekiela wants to merge 2 commits into
Conversation
Signed-off-by: Kamil Tekiela <[email protected]> Co-authored-by: Claude Sonnet 5 <[email protected]>
Signed-off-by: Kamil Tekiela <[email protected]> Co-authored-by: Claude Sonnet 5 <[email protected]>
|
I measured this on master c65321c (15438e3 merges cleanly) with GCC 13.3, GCC 14.2, clang 18.1 and clang 20.1 on an i7-13700H, built with the flags of the official Docker image. Change in CPU cycles per
Payloads with many Instructions with GCC. GCC 13 and 14 execute additional instructions on payloads without references: about 4.1 per int on 6,200 ints and 0.85–3.8 per string on 50,000 strings, or 0.2–1.0% of the call. On 6,200 ints, the clang increase is 0.15–0.16 instructions per int. The PR adds chunk-list bookkeeping to the chunk-allocation branch in Moving the body of that branch into a Correctness: output identical to master with all four compilers and under ASan/UBSan, on 1,429 targeted payloads covering Tests: The PR changes Full tables, scripts and data: https://github.com/ArtUkrainskiy/php-src-bench/tree/main/reports/pr-23110-unserialize-var-access |
Girgias
left a comment
There was a problem hiding this comment.
This seems incredibly unworthy while adding monumental complexity.
|
I agree. It looked to me initially like it would provide a much bigger improvement. Thanks for analysis @ArtUkrainskiy |
NOTE: I did not write this PR. This is part of my experiments with Claude. This PR was created entirely by Claude Sonnet 5 and tested by me.
Benchmarking shows that there is real improvement, although the results vary depending on the size and contents of the payload. There doesn't seem to be any performance degradation in a normal case.
Code comments have been committed separately so that they can be discarded.
Please treat this as an experiment. If you don't feel comfortable reviewing or merging it, please don't.