Repository navigation
Commit 0401e57
committed
Decide sealed array shapes with disjoint required keys before comparing values
ConstantArrayType::isSuperTypeOf() walks the keys of $this in order and
only reports that the other shape lacks a required key when it reaches
that key - after asking the other shape for the offset and comparing the
value of every key before it. Two sealed shapes where one has a required
key the other lacks share no value, and that is now decided from the key
sets first. The answer is the same No; when a value mismatch also comes
earlier in key order, the reason is now the sealed-shapes one instead of
the offset's.
hasOffsetValueType() and getOffsetValueType() also scanned every key with
isSuperTypeOf() for a constant offset the key index has no entry for,
which can only ever find nothing. A non-compound constant int or string
offset missing from the index now skips that scan.
A chain of `if ($pN !== null) { $data['kN'] = $pN; }` builds a sealed
shape under bleedingEdge, and every if-merge rechecks the growing list of
conditional holders guarded by earlier shapes of $data against the
branch's new shape (preserveVacuousConditionalExpressions()). With 90
ifs that took 1.8 s in those checks alone; each check is now a few key
lookups.
Amp-Thread-ID: https://ampcode.com/threads/T-01a1b24f-ec49-7194-bbd2-0f4a43ab9b8f1 parent a76fdbf commit 0401e57
5 files changed
Lines changed: 571 additions & 55 deletions
File tree
- src/Type/Constant
- tests/bench/data
- turbo-ext
- src
- generated
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
797 | 797 | | |
798 | 798 | | |
799 | 799 | | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
800 | 811 | | |
801 | 812 | | |
802 | 813 | | |
| |||
1228 | 1239 | | |
1229 | 1240 | | |
1230 | 1241 | | |
1231 | | - | |
1232 | | - | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
1233 | 1245 | | |
1234 | 1246 | | |
1235 | 1247 | | |
| |||
1239 | 1251 | | |
1240 | 1252 | | |
1241 | 1253 | | |
1242 | | - | |
| 1254 | + | |
1243 | 1255 | | |
1244 | 1256 | | |
1245 | 1257 | | |
| |||
1310 | 1322 | | |
1311 | 1323 | | |
1312 | 1324 | | |
1313 | | - | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
1314 | 1334 | | |
1315 | 1335 | | |
1316 | 1336 | | |
| |||
3289 | 3309 | | |
3290 | 3310 | | |
3291 | 3311 | | |
| 3312 | + | |
| 3313 | + | |
| 3314 | + | |
| 3315 | + | |
| 3316 | + | |
| 3317 | + | |
| 3318 | + | |
| 3319 | + | |
| 3320 | + | |
| 3321 | + | |
| 3322 | + | |
| 3323 | + | |
| 3324 | + | |
| 3325 | + | |
| 3326 | + | |
| 3327 | + | |
| 3328 | + | |
| 3329 | + | |
| 3330 | + | |
| 3331 | + | |
| 3332 | + | |
| 3333 | + | |
| 3334 | + | |
| 3335 | + | |
| 3336 | + | |
| 3337 | + | |
| 3338 | + | |
| 3339 | + | |
| 3340 | + | |
| 3341 | + | |
| 3342 | + | |
| 3343 | + | |
3292 | 3344 | | |
3293 | 3345 | | |
3294 | 3346 | | |
| |||
0 commit comments