aboutsummaryrefslogtreecommitdiff
path: root/tests/bench/sieve.zc
diff options
context:
space:
mode:
authorGravatar zinc <zinc@downsta.ir> 2026-10-14 21:45:29 +0330
committerGravatar zinc <zinc@downsta.ir> 2026-10-14 21:45:29 +0330
commit7a8c67cbf35e167eb4dd845668287e2217aaeabf (patch)
tree90903953e55c5a04d631f16f1fcd7961cd983cfc /tests/bench/sieve.zc
parentbench: baseline re-saved on main with the checks column and the rescaled arra... (diff)
bench: sieve.zc and trees.zc take namespace and include rt, so run.py's checksums pass on main again (todo item closed)
Diffstat (limited to 'tests/bench/sieve.zc')
-rw-r--r--tests/bench/sieve.zc18
1 files changed, 10 insertions, 8 deletions
diff --git a/tests/bench/sieve.zc b/tests/bench/sieve.zc
index 9259bf4..9073201 100644
--- a/tests/bench/sieve.zc
+++ b/tests/bench/sieve.zc
@@ -1,3 +1,5 @@
+namespace;
+include rt;
// primes below N. the same loops as tests/bench/sieve.c: one word per flag,
// marks start at i*i. the count is 9592.
// a fixed int[?], bounds-checked, plain bytecode
@@ -30,22 +32,22 @@ o3 int sieve_raw(int* f) {
return c;
}
int main() {
- int which = get_c(), reps = 0, ch = get_c(), r = 0;
- while (ch >= '0' && ch <= '9') { reps = reps * 10 + ch - '0'; ch = get_c(); }
+ int which = rt.get_c(), reps = 0, ch = rt.get_c(), r = 0;
+ while (ch >= '0' && ch <= '9') { reps = reps * 10 + ch - '0'; ch = rt.get_c(); }
if (which == 'c') {
- int* raw = new(int, N);
+ int* raw = rt.new(int, N);
while (reps > 0) { r = sieve_raw(raw); reps--; }
- put_n(r); put_c(10);
- free(d*raw);
+ rt.put_n(r); rt.put_c(10);
+ rt.free(d*raw);
return 0;
}
- fixed int[?] f = new(fixed int[?], N);
+ fixed int[?] f = rt.new(fixed int[?], N);
while (reps > 0) {
if (which == 'b') r = sieve3(f);
else r = sieve(f);
reps--;
}
- put_n(r); put_c(10);
- free(d*f);
+ rt.put_n(r); rt.put_c(10);
+ rt.free(d*f);
return 0;
}