summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2017-09-09 23:51:17 -0700
committerOri Bernstein <ori@eigenstate.org>2017-09-10 01:07:53 -0700
commitbefeeb302c131fc318430bbdcdff2a5d3d18c6d0 (patch)
tree0767c5706e80586f57e355bd7ec12e601eb6fac5
parent509d071791cc2c008759f637931b7afea73c083b (diff)
downloadmc-befeeb302c131fc318430bbdcdff2a5d3d18c6d0.tar.gz
Add hash table htget benchmark.
-rw-r--r--bench/hashit.myr14
1 files changed, 11 insertions, 3 deletions
diff --git a/bench/hashit.myr b/bench/hashit.myr
index 4856bf9..fbf4011 100644
--- a/bench/hashit.myr
+++ b/bench/hashit.myr
@@ -3,20 +3,28 @@ use testr
const main = {
testr.bench([
- [.name="hashstr", .fn={ctx;
+ [.name="hashstr", .fn={ctx;
for var i = 0; i < 1000; i++
std.strhash("foobar")
;;
}],
- [.name="hashint", .fn={ctx;
+ [.name="hashint", .fn={ctx
for var i = 0; i < 1000; i++
std.inthash(123)
;;
}],
- [.name="hashlongstr", .fn={ctx;
+ [.name="hashlongstr", .fn={ctx
for var i = 0; i < 1000; i++
std.strhash(a)
;;
+ }],
+ [.name="htget", .fn={ctx
+ var h = std.mkht(std.strhash, std.streq)
+ std.htput(h, "foo", 123)
+ for var i = 0; i < 1000; i++
+ std.htget(h, "foo")
+ ;;
+ std.htfree(h)
}]
][:])
}