We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
benchmarking
local x = 5 x ..= ""
versus
local x = 5 x = tostring(x)
the ..= version is ~100us faster than tostring(), even though ..= doesn't typecheck and isn't as idiomatic.
..=
The text was updated successfully, but these errors were encountered:
Backing up that "faster" claim: (the 100us metric in OP was with N=10k, I've bumped it to 20k in the screenshot to show it more easily at a glance)
Using the following to test:
local N = 20_000 return { ParameterGenerator = function() local nums = table.create(N) for i=1, N do nums[i] = math.random(1, 10000000) end return nums end, Functions = { ["concat"] = function(Profiler, nums) for _, num in nums do num ..= "" end end, ["tostring"] = function(Profiler, nums) for _, num in nums do num = tostring(num) end end, ["format"] = function(Profiler, nums) for _, num in nums do num = string.format("%f", num) end end, }, }
Sorry, something went wrong.
I think that's just a performance bug. We don't have a fastcall for tostring/tonumber - we absolutely can add that.
zeux
Successfully merging a pull request may close this issue.
benchmarking
versus
the
..=
version is ~100us faster than tostring(), even though..=
doesn't typecheck and isn't as idiomatic.The text was updated successfully, but these errors were encountered: