summaryrefslogtreecommitdiff
path: root/tests/benchmarks/hash.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2025-09-30 22:43:05 +0800
committerruki <[email protected]>2025-09-30 22:43:05 +0800
commit703dec087d98946bc2ba5384d2274e588f8ee96d (patch)
tree27cc9c304c05c2916135b3afc2d8e4e51f828834 /tests/benchmarks/hash.lua
parent9dd7fe46d8678216b62016b721fe084d5bad9246 (diff)
improve strhash
Diffstat (limited to 'tests/benchmarks/hash.lua')
-rw-r--r--tests/benchmarks/hash.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/benchmarks/hash.lua b/tests/benchmarks/hash.lua
index 8c70c342a..48c360d58 100644
--- a/tests/benchmarks/hash.lua
+++ b/tests/benchmarks/hash.lua
@@ -75,24 +75,24 @@ end
function test_strhash32(data)
local h
- local n = COUNT / 10000
+ local n = COUNT / 10
local t = os.mclock()
for i = 1, n do
h = hash.strhash32(data)
end
t = os.mclock() - t
- print("strhash32(%d): %d ms, hash: %s", COUNT, t * 10000, h)
+ print("strhash32(%d): %d ms, hash: %s", COUNT, t * 10, h)
end
function test_strhash128(data)
local h
- local n = COUNT / 10000
+ local n = COUNT / 10
local t = os.mclock()
for i = 1, n do
h = hash.strhash128(data)
end
t = os.mclock() - t
- print("strhash128(%d): %d ms, hash: %s", COUNT, t * 10000, h)
+ print("strhash128(%d): %d ms, hash: %s", COUNT, t * 10, h)
end
function test_longstr()
@@ -113,6 +113,7 @@ end
function test_shortstr()
print("========================================== test short string ==========================================")
+ COUNT = COUNT * 100
local data = ""
for i = 1, 10 do
data = data .. "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"