ref: c3b5d8f485e8d981d12d7c59386f39125cb3a864
dir: /bench/hashit.myr/
use std use testr const main = { testr.bench([ [.name="hashstr", .fn={ctx; for var i = 0; i < 1000; i++ std.strhash("foobar") ;; }], [.name="hashint", .fn={ctx for var i = 0; i < 1000; i++ std.inthash(123) ;; }], [.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) }], [.name="htput", .fn={ctx var h = std.mkht(std.strhash, std.streq) for var i = 0; i < 1000; i++ std.htput(h, "foo", 123) ;; std.htfree(h) }], [.name="htputmany", .fn={ctx var h = std.mkht(std.inthash, std.inteq) for var i = 0; i < 1000; i++ std.htput(h, i, 123) ;; std.htfree(h) }], ][:]) } const a = \ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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