Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .jules/bolt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 2026-08-19 - Removed redundant instruction array lookup in VM loop
**Learning:** The inner loop of the VM interpreter (`execute_loop`) had an expensive, redundant deep indexing operation to fetch `inst_operands` which was already available on the `inst` reference. Re-fetching it via `self.module.functions[...].chunk.instructions[...].operands` adds unnecessary bounds checks and pointer chasing in the hottest part of the VM.
**Action:** Always prefer using existing local references over redundant deep lookups, especially in tight loops like an interpreter fetch-decode-execute loop.
7 changes: 1 addition & 6 deletions runtime/vm/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,7 @@ impl VM {
let ip = frame.ip;
frame.ip += 1;

let inst_operands = self.module.functions
[self.frames.last().unwrap().function_idx as usize]
.chunk
.instructions[ip]
.operands
.as_slice();
let inst_operands = inst.operands.as_slice();

// Diagnostics and tracing
self.profiler.record_instruction();
Expand Down
Loading