mirror of
https://github.com/luau-lang/luau.git
synced 2025-01-08 12:29:09 +00:00
0b2755f964
* Progress toward a diffing algorithm for types. We hope that this will be useful for writing clearer error messages. * Add a missing recursion limiter in `Unifier::tryUnifyTables`. This was causing a crash in certain situations. * Luau heap graph enumeration improvements: * Weak references are not reported * Added tag as a fallback name of non-string table links * Included top Luau function information in thread name to understand where thread might be suspended * Constant folding for `math.pi` and `math.huge` at -O2 * Optimize `string.format` and `%*` * This change makes string interpolation 1.5x-2x faster depending on the number and type of formatted components, assuming a few are using primitive types, and reduces associated GC pressure. New type checker: * Initial work toward tracking the upper and lower bounds of types accurately. Native code generation (JIT): * Add IrCmd::CHECK_TRUTHY for improved assert fast-calls * Do not compute type map for modules without types * Capture metatable+readonly state for NEW_TABLE IR instructions * Replace JUMP_CMP_ANY with CMP_ANY and existing JUMP_EQ_INT * Add support for exits to VM with reentry lock in VmExit --------- Co-authored-by: Arseny Kapoulkine <arseny.kapoulkine@gmail.com> Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>
44 lines
No EOL
915 B
Lua
44 lines
No EOL
915 B
Lua
local bench = script and require(script.Parent.bench_support) or require("bench_support")
|
|
|
|
bench.runCode(function()
|
|
for j=1,1e6 do
|
|
local _ = "j=" .. tostring(j)
|
|
end
|
|
end, "interp: tostring")
|
|
|
|
bench.runCode(function()
|
|
for j=1,1e6 do
|
|
local _ = "j=" .. j
|
|
end
|
|
end, "interp: concat")
|
|
|
|
bench.runCode(function()
|
|
for j=1,1e6 do
|
|
local _ = string.format("j=%f", j)
|
|
end
|
|
end, "interp: %f format")
|
|
|
|
bench.runCode(function()
|
|
for j=1,1e6 do
|
|
local _ = string.format("j=%d", j)
|
|
end
|
|
end, "interp: %d format")
|
|
|
|
bench.runCode(function()
|
|
for j=1,1e6 do
|
|
local _ = string.format("j=%*", j)
|
|
end
|
|
end, "interp: %* format")
|
|
|
|
bench.runCode(function()
|
|
for j=1,1e6 do
|
|
local _ = `j={j}`
|
|
end
|
|
end, "interp: interp number")
|
|
|
|
bench.runCode(function()
|
|
local ok = "hello!"
|
|
for j=1,1e6 do
|
|
local _ = `j={ok}`
|
|
end
|
|
end, "interp: interp string") |