Commit 13ccd02
committed
ref(perf): keep executeField inlinable by extracting traced path
Hoist the resolve tracing decision once per `executeFields` /
`executeFieldsSerially` call instead of re-checking
`shouldTrace(resolveChannel)` per field, and move the traced branch's
`traceMixed` call + ctx closure into a module-scope helper
`invokeResolverWithTracing`. The latter is the load-bearing change:
once `executeField`'s body referenced `traceMixed` and the
`() => resolveFn(...)` closure, V8 stopped inlining `executeField` into
`executeFields`, paying a real call frame per field. Extracting the
two-function tail keeps `executeField`'s bytecode small enough to
inline again.
Effect on the introspection benchmark (the worst-case fan-out shape,
~1000 resolver calls per iteration, no subscribers attached):
- with the inline ternary: -5.94% vs upstream
- with this refactor: -2.05% / -2.30% across two paired runs
Other benchmarks (list-sync, list-async, list-asyncIterable,
object-async) sit at the noise floor with 95% CIs that cross zero.
Adds a serial-mutation case to resolve-diagnostics-test to cover the
`executeFieldsSerially` branch the hoisted snapshot now lives in.1 parent bbddc0c commit 13ccd02
2 files changed
Lines changed: 69 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
480 | 481 | | |
481 | 482 | | |
482 | 483 | | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
483 | 487 | | |
484 | 488 | | |
485 | 489 | | |
| |||
493 | 497 | | |
494 | 498 | | |
495 | 499 | | |
| 500 | + | |
496 | 501 | | |
497 | 502 | | |
498 | 503 | | |
| |||
523 | 528 | | |
524 | 529 | | |
525 | 530 | | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
526 | 534 | | |
527 | 535 | | |
528 | 536 | | |
| |||
533 | 541 | | |
534 | 542 | | |
535 | 543 | | |
| 544 | + | |
536 | 545 | | |
537 | 546 | | |
538 | 547 | | |
| |||
574 | 583 | | |
575 | 584 | | |
576 | 585 | | |
| 586 | + | |
577 | 587 | | |
578 | 588 | | |
579 | 589 | | |
| |||
615 | 625 | | |
616 | 626 | | |
617 | 627 | | |
618 | | - | |
619 | | - | |
620 | | - | |
621 | | - | |
622 | | - | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
623 | 637 | | |
624 | 638 | | |
625 | 639 | | |
| |||
1430 | 1444 | | |
1431 | 1445 | | |
1432 | 1446 | | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
181 | 210 | | |
182 | 211 | | |
183 | 212 | | |
| |||
0 commit comments