Skip to content
Merged
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
8 changes: 5 additions & 3 deletions runtime/vm/src/debugger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ impl VMDebugger {
return;
}

let op_str = format!("{:?}", op_code);
// Bolt performance optimization: Avoid unnecessary string allocation for op_code.
// `op_code` implements `Debug`, so we can format it directly into the final string
// instead of pre-allocating an intermediate String with `format!`.
let mut operands_str = String::new();

for op in operands {
Expand Down Expand Up @@ -93,8 +95,8 @@ impl VMDebugger {
}

println!(
"[{:04}] {:<15} {} | Stack: {:?}",
ip, op_str, operands_str, stack_dump
"[{:04}] {:<15?} {} | Stack: {:?}",
ip, op_code, operands_str, stack_dump
);
}
}
Loading