Eliminate lazy initialization overhead from interpreter hot paths (~8% faster) by lahma · Pull Request #2346 · sebastienros/jint (original) (raw)

@lahma @claude

…% faster)

Remove _initialized bool check from every statement execution and expression evaluation by moving initialization work into constructors. Previously, each JintStatement.Execute() call checked if (!_initialized) on every invocation, adding a branch to the interpreter's hottest path. Since none of the Initialize() methods actually needed the EvaluationContext, moving them to constructors is safe.

Changes:

SunSpider benchmark: 2,693ms → 2,474ms (-8.2%, 26 tests) Test262: 0 failures, 95,798 passing

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com