assert_equal(cmp, 0, "fuzz test failed for length: " .. tostring(l))
end
end)
+
+ local speed_iters = 10000
+
test("Base64 test reference vectors 1K", function()
local t1 = ffi.C.rspamd_get_ticks()
- local res = ffi.C.base64_test(true, 1000000, 1024)
+ local res = ffi.C.base64_test(true, speed_iters, 1024)
local t2 = ffi.C.rspamd_get_ticks()
print("Reference base64 (1K): " .. tostring(t2 - t1) .. " sec")
end)
test("Base64 test optimized vectors 1K", function()
local t1 = ffi.C.rspamd_get_ticks()
- local res = ffi.C.base64_test(false, 1000000, 1024)
+ local res = ffi.C.base64_test(false, speed_iters, 1024)
local t2 = ffi.C.rspamd_get_ticks()
print("Optimized base64 (1K): " .. tostring(t2 - t1) .. " sec")
end)
test("Base64 test reference vectors 512", function()
local t1 = ffi.C.rspamd_get_ticks()
- local res = ffi.C.base64_test(true, 1000000, 512)
+ local res = ffi.C.base64_test(true, speed_iters, 512)
local t2 = ffi.C.rspamd_get_ticks()
print("Reference base64 (512): " .. tostring(t2 - t1) .. " sec")
end)
test("Base64 test optimized vectors 512", function()
local t1 = ffi.C.rspamd_get_ticks()
- local res = ffi.C.base64_test(false, 1000000, 512)
+ local res = ffi.C.base64_test(false, speed_iters, 512)
local t2 = ffi.C.rspamd_get_ticks()
print("Optimized base64 (512): " .. tostring(t2 - t1) .. " sec")
end)
test("Base64 test reference vectors 10K", function()
local t1 = ffi.C.rspamd_get_ticks()
- local res = ffi.C.base64_test(true, 100000, 10240)
+ local res = ffi.C.base64_test(true, speed_iters / 100, 10240)
local t2 = ffi.C.rspamd_get_ticks()
print("Reference base64 (10K): " .. tostring(t2 - t1) .. " sec")
end)
test("Base64 test optimized vectors 10K", function()
local t1 = ffi.C.rspamd_get_ticks()
- local res = ffi.C.base64_test(false, 100000, 10240)
+ local res = ffi.C.base64_test(false, speed_iters / 100, 10240)
local t2 = ffi.C.rspamd_get_ticks()
print("Optimized base64 (10K): " .. tostring(t2 - t1) .. " sec")
ffi.C.rspamd_cryptobox_init()
+ local speed_iters = 1000
+
test("Siphash test reference vectors (1KB)", function()
local t1 = ffi.C.rspamd_get_ticks()
- local res = ffi.C.siphash24_test(true, 100000, 1024)
+ local res = ffi.C.siphash24_test(true, speed_iters, 1024)
local t2 = ffi.C.rspamd_get_ticks()
print("Reference siphash (1KB): " .. tostring(t2 - t1) .. " sec")
end)
test("Siphash test optimized vectors (1KB)", function()
local t1 = ffi.C.rspamd_get_ticks()
- local res = ffi.C.siphash24_test(false, 100000, 1024)
+ local res = ffi.C.siphash24_test(false, speed_iters, 1024)
local t2 = ffi.C.rspamd_get_ticks()
print("Optimized siphash (1KB): " .. tostring(t2 - t1) .. " sec")
end)
test("Siphash test reference vectors (5B)", function()
local t1 = ffi.C.rspamd_get_ticks()
- local res = ffi.C.siphash24_test(true, 1000000, 5)
+ local res = ffi.C.siphash24_test(true, speed_iters, 5)
local t2 = ffi.C.rspamd_get_ticks()
print("Reference siphash (5B): " .. tostring(t2 - t1) .. " sec")
end)
test("Siphash test optimized vectors (5B)", function()
local t1 = ffi.C.rspamd_get_ticks()
- local res = ffi.C.siphash24_test(false, 1000000, 5)
+ local res = ffi.C.siphash24_test(false, speed_iters, 5)
local t2 = ffi.C.rspamd_get_ticks()
print("Optimized siphash (5B): " .. tostring(t2 - t1) .. " sec")
end)
test("Siphash test reference vectors (50B)", function()
local t1 = ffi.C.rspamd_get_ticks()
- local res = ffi.C.siphash24_test(true, 1000000, 50)
+ local res = ffi.C.siphash24_test(true, speed_iters, 50)
local t2 = ffi.C.rspamd_get_ticks()
print("Reference siphash (50B): " .. tostring(t2 - t1) .. " sec")
end)
test("Siphash test optimized vectors (50B)", function()
local t1 = ffi.C.rspamd_get_ticks()
- local res = ffi.C.siphash24_test(false, 1000000, 50)
+ local res = ffi.C.siphash24_test(false, speed_iters, 50)
local t2 = ffi.C.rspamd_get_ticks()
print("Optimized siphash (50B): " .. tostring(t2 - t1) .. " sec")