Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Roblox
GitHub Repository: Roblox/luau
Path: blob/master/bench/micro_tests/test_ToNumberString.lua
2725 views
1
local function prequire(name) local success, result = pcall(require, name); return success and result end
2
local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support")
3
4
bench.runCode(function()
5
for j=1,1e6 do
6
tonumber("42")
7
tonumber(42)
8
end
9
end, "tonumber")
10
11
bench.runCode(function()
12
for j=1,1e6 do
13
tostring(nil)
14
tostring("test")
15
tostring(42)
16
end
17
end, "tostring")
18
19
bench.runCode(function()
20
for j=1,1e6 do
21
tostring(j)
22
end
23
end, "tostring-gc")
24
25