Repository navigation
Speed up deepclone_from_array() - #65
Merged
Merged
Conversation
nicolas-grekas
force-pushed
the
from-array-perf
branch
from
October 14, 2026 09:06
99ac90f to
8b49db4
Compare
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.
Ideas from symfony/polyfill#716, plus the ones profiling showed.
On the 57 cached payloads of https://github.com/nicolas-grekas/symfony-showcase (Doctrine metadata, serializer, validator, property info and object mapper),
deepclone_from_array()needs 14% fewer instructions. On a graph of 1600 objects, it needs 18% fewer.zend_std_write_property(), which looks them up again. This applies when the slot contains no reference, no__set()applies and a readonly property isn't initialized yet. The type is checked like before, in coercive mode.stdClassscope is looked up once per class instead of once per object.allow_named_closures, the payload is scanned for closures once instead of twice. The scans skip scalar markers.The results are the same before and after on 11,000 fuzzed payloads.