Commit 5116a1f
committed
Add direct-write fast path for bare-name keys in MANGLED_VARS mode
When $vars is a flat dictionary of bare property names (no
"\0ClassName\0prop" mangling), the pre-existing MANGLED_VARS parser
resolved each key to (scope, name), stashed it in an intermediate
scoped_props HashTable, then ran the regular scoped-mode write in a
second pass. Pure overhead for the common case.
The parser now resolves the property_info for each bare key and, when
it points at a real backed declared property, writes via
dc_write_backed_property() immediately — skipping the scoped_props
accumulation and the second-pass iteration. NUL-prefix (mangled) keys,
unresolved names, and hooked/virtual properties keep the original path
so error handling, scope tracking, and per-scope EG(fake_scope) stay
unchanged.
Bench, Customer (11 fields, 3-level inheritance), 100-entity batch
on PHP 8.4:
| shape | before | after |
|-----------------------------------------------------|-------:|------:|
| deepclone_hydrate($class, $flatRow, MANGLED_VARS) | 1,275 | 486 |
| Doctrine setValue loop (reference, unchanged) | 1,131 | 1,131 |
That's a 2.33x speedup over Doctrine's current approach, down to
within ~58 ns of the hand-built scoped-shape path. The Doctrine pitch
becomes "pass the PDO row dict as-is, done." — no per-row scope
grouping, no mangled-key construction.1 parent 9072a51 commit 5116a1f
1 file changed
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3101 | 3101 | | |
3102 | 3102 | | |
3103 | 3103 | | |
| 3104 | + | |
| 3105 | + | |
| 3106 | + | |
| 3107 | + | |
| 3108 | + | |
| 3109 | + | |
| 3110 | + | |
| 3111 | + | |
| 3112 | + | |
| 3113 | + | |
| 3114 | + | |
| 3115 | + | |
| 3116 | + | |
| 3117 | + | |
| 3118 | + | |
| 3119 | + | |
| 3120 | + | |
| 3121 | + | |
| 3122 | + | |
3104 | 3123 | | |
3105 | 3124 | | |
3106 | 3125 | | |
| |||
0 commit comments