⚡️Use prototyped class for ScopeInternal#1184
Conversation
The scope implementation was creating a unique prototype for every single scope instance which caused depotimization of every single scope method. This extracts all the core methods into a single prototype based class that shares a single implementation among all instances, which allows V8 (and presumably other runtimes) to inline the implementation.
commit: |
Merging this PR will improve performance by 15.14%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | Memory | effection.events |
91.7 KB | 79.7 KB | +15.14% |
Tip
Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.
Comparing classify-scope-internal (83e7bfc) with v4 (846b97e)
Pre-merge check: verify Symbol-keyed augmentations still workThe wrapper change moves
Both rely on
If both pass on this branch, this comment can be resolved. |
Motivation
The scope implementation was creating a unique prototype for every single scope instance which caused depotimization of every single scope method.
Approach
This extracts all the core methods into a single prototype based class that shares a single implementation among all instances, which allows V8 (and presumably other runtimes) to inline the implementation.