This site describes solve-engine as it is on main: 2.43.0, which npm does not have yet. npm installs 2.40.0, so a page may show an answer that version does not give yet.
executeBytecode
function executeBytecode( bytecode, vm, pipeline?, expression?, context?, symbolicTolerant?): EvalResult;Defined in: packages/engine/src/vm/VM.ts:3612
Execute bytecode with optional diagnostic pipeline integration.
Performance notes:
- Uses a
switch(op)statement for dispatch. V8 compiles dense integer switches (OpCode values 0–200) into a jump table with O(1) dispatch. The common handlers are inlined in the switch cases; the rarely used ones are module-level helpers (see the note above them), because V8 will not optimise this function at all once its bytecode passes 61,440 bytes. - ADD/SUB/MUL/DIV and the six comparisons open with an inlined plain-number
branch: two Numbers carrying no rational or uncertainty sidecar (>90% of
arithmetic ops) are answered before any helper (fault propagation,
percentage, rate period, money, unit,
binaryOp()) is called. The sidecar checks are what keep the branch honest: an exact fraction or a measurement takes the ladder below it, exactly as before. - Tracing uses a boolean guard (
shouldTrace) that the JIT eliminates entirely when diagnostics are disabled. No function call overhead. Value.toNumber()caches its result, computed once, read thereafter.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
bytecode | Bytecode |
vm | VM |
pipeline? | DiagnosticPipeline |
expression? | string |
context? | LineExecutionContext |
symbolicTolerant? | boolean |
Returns
Section titled “Returns”EvalResult