You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CommonJS model: shape-gate cost (the verdict is applied after the model, and quiet() is not memoized) #37
Found in the round-1 review of branch fix/commonjs-model-gaps (stacked on PR #29).
The shape gate (with expandEvals, which builds up to 3 more programs) is computed up front, but its verdict is applied only after the whole value model has run. So every file the gate turns away still pays for the full model. That covers loops, try, UMD wrappers, comma statements and require('x')(...), which is most real-world and bundled CommonJS. The order exists so a file the model already turns away keeps its more specific reason. Run the gate first, and keep the specific reason only where it is cheap.
quiet() is not memoized, so N call sites of the same helper re-walk its body (and the bodies of the functions it calls) N times. A Map<FunctionLikeDeclaration, boolean> for one gate run makes it linear.
Related: Express indexing CPU is already about +38% on PR #29.
Activity