Repository navigation
fix(engine): unify loop fuel enforcement and reporting (#43) - #64
Merged
Merged
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #43
Summary
#43):SliceIsolate::apply_boa_realm_runtime_limits(set_loop_iteration_limit(remaining_fuel)) andSliceIsolate::finish_boa_compartment_execution(consume_fuel(loop_iters)) to the exact same1fuel unit per1iteration scale, and movedapply_boa_realm_runtime_limitsto run immediately before guest script evaluation (after cold-realm prelude/shard initialization).CallFrame::loop_iteration_count(context.vm.frame_mut()heap dereference on every loop iteration) with inlineRuntimeLimits::check_and_increment_loop_iteration()(next > self.loop_iteration), shrinkingCallFrameby 8 bytes and eliminating off-by-one boundary drift.IncrementLoopIterationafter the loop exit branch incompile_while_loop,compile_for_in_loop, andcompile_for_of_loop, and routed top-levelwhileloops (in_function_depth == 0) to Boa's bytecode VM.reported fuelUsed == smallest budget that completesparity acrossfor(4005 == 4005),while(1000010 == 1000010), anddo-while(1000010 == 1000010).v0.10.8):tests/reports/bench_v0.10.8_20261111_000408Z_8e712ae.md(33/33faster than Deno & Node.js,33/33faster in--warmpooled execution,172,255 req/sTier-0slice serveand158,151 req/sTier-1 WinterTCslice serve).