mirror of
https://github.com/luau-lang/luau.git
synced 2024-12-14 22:21:10 +00:00
aafea36235
Previous benchmark require fix wasn't actually working correctly for the old style require (or running in Lua).
23 lines
586 B
Lua
23 lines
586 B
Lua
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")
|
|
|
|
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")
|