diff options
author | Ori Bernstein <ori@eigenstate.org> | 2015-10-02 23:27:11 -0700 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2015-10-02 23:27:11 -0700 |
commit | 08442dd9c3426e2dbe598ef1f6fb10f2f67638aa (patch) | |
tree | f8a9d3092248258e5a33bb17fe3a985868ae2ef8 /bench/copious-allocs.myr | |
parent | 76086513de9efd7a000d0bc229c3e990f0af5a2f (diff) | |
download | mc-08442dd9c3426e2dbe598ef1f6fb10f2f67638aa.tar.gz |
Implement some asm optimized memcpy/memmove checks.
TODO: memcmp
Diffstat (limited to 'bench/copious-allocs.myr')
-rw-r--r-- | bench/copious-allocs.myr | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/bench/copious-allocs.myr b/bench/copious-allocs.myr index 1237b7f..7b02594 100644 --- a/bench/copious-allocs.myr +++ b/bench/copious-allocs.myr @@ -5,32 +5,31 @@ type blob = struct ;; const main = { - var i, j var a : blob#[10000] - for j = 0; j < 100; j++ + for var j = 0; j < 100; j++ /* alloc forwards, dealloc forwards */ - for i = 0; i < a.len; i++ + for var i = 0; i < a.len; i++ a[i] = std.alloc() ;; - for i = 0; i < a.len; i++ + for var i = 0; i < a.len; i++ std.free(a[i]) ;; /* alloc forwards, dealloc backwards */ - for i = 0; i < a.len; i++ + for var i = 0; i < a.len; i++ a[i] = std.alloc() ;; - for i = a.len; i > 0; i-- + for var i = a.len; i > 0; i-- std.free(a[i - 1]) ;; /* alloc forwards, dealloc randomly */ - for i = 0; i < a.len; i++ + for var i = 0; i < a.len; i++ a[i] = std.alloc() ;; shuffle(a[:]) - for i = a.len; i > 0; i-- + for var i = a.len; i > 0; i-- std.free(a[i - 1]) ;; ;; @@ -39,10 +38,11 @@ const main = { const shuffle = {a var t var rng - var i, j + var j + /* we want determinism for benchmarking */ rng = std.mksrng(123) - for i = 0; i < a.len - 1; i++ + for var i = 0; i < a.len - 1; i++ j = std.rngrand(rng, i, a.len) t = a[j] a[j] = a[i] |