diff options
| -rw-r--r-- | TODO.md | 1 | ||||
| -rw-r--r-- | tests/bench/sieve.zc | 18 | ||||
| -rw-r--r-- | tests/bench/trees.zc | 22 |
3 files changed, 22 insertions, 19 deletions
@@ -541,7 +541,6 @@ brief someone without re-reading the code. - [ ] gc roots change: its own branch, memdebug scrub, full suite, bench comparison, and the owner reviews it before merge. - [ ] shrink the 500 genome words added by b.2.13. - [ ] file-level `o3;` and `unchecked;` directives that apply to every function after them, like `memdebug scrub;`. they replace the deferred top-level `o3 {}` and `unchecked {}` blocks. -- [ ] tests/bench/run.py: the checksum step fails to compile the zc sieve on main, so run.py's sieve/trees timings don't run; bench.sh covers sieve only. - [ ] run the full suite once everything above is done (`make test JOBS=4`; `make check` is the quick one), fix what it finds, and only then tick this item. ## done in the sorted list 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; } diff --git a/tests/bench/trees.zc b/tests/bench/trees.zc index c8f46ef..173f187 100644 --- a/tests/bench/trees.zc +++ b/tests/bench/trees.zc @@ -1,5 +1,7 @@ +namespace; +include rt; // a full binary tree of depth D. checksum is the node count, 8191. -// each node is two pointers. new() rounds that plus the 5-word header up +// each node is two pointers. rt.new() rounds that plus the 5-word header up // to 8 words (a 4-word block cannot hold the header). free of the owned // root recycles the tree onto the size-class lists. // a plain new / own / free @@ -14,7 +16,7 @@ int* heap; int used; node*.u make(int depth) { - node* n = new(node); + node* n = rt.new(node); if (depth > 0) { n.left = make(depth - 1); n.right = make(depth - 1); @@ -25,7 +27,7 @@ node*.u make(int depth) { return u*n; } o3 node*.u make3(int depth) { - node* n = new(node); + node* n = rt.new(node); if (depth > 0) { n.left = make3(depth - 1); n.right = make3(depth - 1); @@ -67,26 +69,26 @@ o3 int ck(int id) { } 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') { - heap = new(int, WORDS); + heap = rt.new(int, WORDS); while (reps > 0) { used = 0; r = ck(build(D)); reps--; } - put_n(r); put_c(10); + rt.put_n(r); rt.put_c(10); return 0; } while (reps > 0) { if (which == 'b') { node* root = make3(D); r = check3(root); - free(d*root); + rt.free(d*root); } else { node* root = make(D); r = check(root); - free(d*root); + rt.free(d*root); } reps--; } - put_n(r); put_c(10); + rt.put_n(r); rt.put_c(10); return 0; } |
