MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / regalloc_hot_loop_is_substantially_faster

Function regalloc_hot_loop_is_substantially_faster

tests/integration/regalloc.rs:127–149  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

125
126#[test]
127fn regalloc_hot_loop_is_substantially_faster() {
128 // A tight arithmetic loop is the allocator's target workload; require a
129 // real win, not statistical noise.
130 let ((_, base_cycles), (_, alloc_cycles)) = assert_equivalent(
131 r#"
132main: () -> i32 {
133 acc: i64 = 0
134 i: i64 = 0
135 while i < 20000 {
136 acc = acc + i * 3 - (i / 2)
137 i = i + 1
138 }
139 return (acc % 100) as i32
140}
141"#,
142 );
143 println!("hot loop cycles: {base_cycles} -> {alloc_cycles}");
144 let saved = base_cycles.saturating_sub(alloc_cycles);
145 assert!(
146 saved * 4 >= base_cycles,
147 "hot loop should run at least 25% faster: {base_cycles} -> {alloc_cycles}"
148 );
149}
150
151#[test]
152fn regalloc_recursion_preserves_callee_saved_values() {

Callers

nothing calls this directly

Calls 1

assert_equivalentFunction · 0.85

Tested by

no test coverage detected