Feat: script execution performance optimization

This commit is contained in:
2026-02-22 14:16:38 +01:00
parent 3d552ec072
commit 81f475a75b
20 changed files with 377 additions and 134 deletions

View File

@@ -32,7 +32,7 @@ fn test_midi_cc_with_channel() {
#[test]
fn test_ccval_returns_zero_without_cc_memory() {
let f = forth();
let mut f = forth();
let ctx = default_ctx();
let outputs = f.evaluate("1 1 ccval", &ctx).unwrap();
assert!(outputs.is_empty());
@@ -50,7 +50,7 @@ fn test_ccval_reads_from_cc_memory() {
cc_memory.set_cc(0, 0, 1, 64); // device 0, channel 1 (0-indexed), CC 1, value 64
cc_memory.set_cc(0, 5, 74, 127); // device 0, channel 6 (0-indexed), CC 74, value 127
let f = forth();
let mut f = forth();
let ctx = StepContext {
cc_access: Some(&cc_memory as &dyn CcAccess),
..default_ctx()
@@ -316,7 +316,7 @@ fn test_midi_note_long_duration() {
#[test]
fn test_midi_note_duration_with_tempo() {
use crate::harness::{ctx_with, forth};
let f = forth();
let mut f = forth();
// At tempo=60, step_duration = 60/60/4/1 = 0.25 seconds
let ctx = ctx_with(|c| c.tempo = 60.0);
let outputs = f.evaluate("60 note m.", &ctx).unwrap();
@@ -326,7 +326,7 @@ fn test_midi_note_duration_with_tempo() {
#[test]
fn test_midi_note_duration_with_speed() {
use crate::harness::{ctx_with, forth};
let f = forth();
let mut f = forth();
// At tempo=120 speed=2, step_duration = 60/120/4/2 = 0.0625 seconds
let ctx = ctx_with(|c| c.speed = 2.0);
let outputs = f.evaluate("60 note m.", &ctx).unwrap();