mirror of
https://github.com/roc-lang/roc.git
synced 2025-11-02 05:48:17 +00:00
fix benchmark-dec, remove callWrapper
This commit is contained in:
parent
2feb5d3c2e
commit
7d4026bd00
2 changed files with 4 additions and 9 deletions
|
|
@ -138,7 +138,7 @@ fn avg_runs(comptime T: type, comptime n: usize, comptime op: fn (T, T) T, v: T)
|
|||
var i: usize = 0;
|
||||
while (i < warmups + repeats) : (i += 1) {
|
||||
// Never inline run to ensure it doesn't optimize for the value of `v`.
|
||||
runs[i] = callWrapper(u64, .never_inline, run, .{ T, n, op, v });
|
||||
runs[i] = @call(.never_inline, run, .{ T, n, op, v });
|
||||
}
|
||||
|
||||
const real_runs = runs[warmups..runs.len];
|
||||
|
|
@ -164,13 +164,13 @@ fn run(comptime T: type, comptime n: usize, comptime op: fn (T, T) T, v: T) u64
|
|||
while (i < outer) : (i += 1) {
|
||||
comptime var j = 0;
|
||||
inline while (j < inner) : (j += 1) {
|
||||
a = callWrapper(T, .always_inline, op, .{ a, v });
|
||||
a = @call(.always_inline, op, .{ a, v });
|
||||
}
|
||||
}
|
||||
const rem = n % max_inline;
|
||||
const j = 0;
|
||||
inline while (j < rem) : (j += 1) {
|
||||
a = callWrapper(T, .always_inline, op, .{ a, v });
|
||||
a = @call(.always_inline, op, .{ a, v });
|
||||
}
|
||||
|
||||
// Clobber `a` to avoid removal as dead code.
|
||||
|
|
@ -182,11 +182,6 @@ fn run(comptime T: type, comptime n: usize, comptime op: fn (T, T) T, v: T) u64
|
|||
return timer.read();
|
||||
}
|
||||
|
||||
// This is needed to work around a bug with using `@call` in loops.
|
||||
inline fn callWrapper(comptime T: type, call_modifier: anytype, comptime func: anytype, params: anytype) T {
|
||||
return @call(call_modifier, func, params);
|
||||
}
|
||||
|
||||
fn addF64(x: f64, y: f64) f64 {
|
||||
return x + y;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,4 +4,4 @@
|
|||
set -euxo pipefail
|
||||
|
||||
zig build-exe benchmark-dec.zig -O ReleaseFast
|
||||
./dec
|
||||
./benchmark-dec
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue