luau/bench/micro_tests/test_ToNumberString.lua

24 lines
586 B
Lua
Raw Normal View History

2023-12-08 23:42:54 +08:00
local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end
local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support")
2023-07-28 19:37:00 +08:00
bench.runCode(function()
for j=1,1e6 do
tonumber("42")
tonumber(42)
end
end, "tonumber")
bench.runCode(function()
for j=1,1e6 do
tostring(nil)
tostring("test")
tostring(42)
end
end, "tostring")
bench.runCode(function()
for j=1,1e6 do
tostring(j)
end
end, "tostring-gc")