Optimize interpreter hot paths for arithmetic, comparisons, and control flow by lahma · Pull Request #2345 · sebastienros/jint (original) (raw)

@lahma @claude

…ol flow

Add double fast paths to arithmetic operators (Plus, Minus, Times, Divide) that skip ToPrimitive/ToNumeric overhead for JsNumber operands. Simplify CompareNumber to check integer type first and handle NaN directly instead of falling back to CompareComplex. Move Remainder's integer check before ToNumeric conversion. Add GetBooleanValue virtual method to JintExpression with overrides on 7 comparison operators, and use it in for-loop, while-loop, and if-statement conditions to avoid JsBoolean wrapper allocation and ToBoolean virtual dispatch.

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

@lahma lahma deleted the perf-improvements branch

March 22, 2026 10:22

This was referenced

Mar 23, 2026

This was referenced

Jun 8, 2026

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})