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