Repository navigation
Hoist per property type meta out of the object loops - #78
Conversation
ObjectAccess now precomputes whether each property is an attribute and which default an absent element decodes to, so decoding no longer reads the type meta for every property of every object it builds. The decode loop is a plain foreach instead of map_with_key with a closure.
Encoding reads the precomputed isAttribute flag from ObjectAccess instead of the property type meta, and builds the child writers in a plain foreach instead of map_with_key with a closure.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 13 minutes. View limit details
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
The PossiblyNullArgument suppression only applies to attribute isos, which accept null, so it now sits on that branch alone.
The if only narrowed the null argument suppression; one match per property reads better.
For every element it decodes or encodes,
ObjectEncoderasks each property's type meta whether it is an attribute and, on decode, whether it is a list. Each answer is anOptionthat gets unwrapped inside a closure called throughmap_with_key. The answers only depend on the type, soObjectAccess::build()now works them out once per type, and both loops inObjectEncoderuse a plain foreach over the precomputed values. The output does not change.ObjectAccessgets two extra constructor arguments. Nothing outside the package builds one, so I took the constructor change for 0.x.3MB synthetic workloads, seconds, median of 3 interleaved rounds:
The phpbench subjects use small objects. Literal decode there is 4% to 7% faster, and the rest stays within the noise of the ext-soap subjects, which this change does not touch.
Summary by CodeRabbit