The compiler on agni is not doing as much constant-folding and dead-code elimination as the CLI tools. Take this script:
print(gcinfo())
local a = "a" .."a".."a".."a".."a".."a".."a".."a".."a".."a"
.."a".."a".."a".."a".."a".."a".."a".."a".."a".."a".."a"
print(gcinfo())
Variable
a
should be constant-folded away, then eliminated as dead code, as it is unused
On simulator version Luau 2026-01-30.21516666911 , this prints
[4:29 PM] Object: 1.4892578125
[4:29 PM] Object: 1.525390625
The two numbers are different, so something entered memory in-between the two gcinfo calls
However, when run locally, it prints:
$ ./slua memtest.luau
38
38
The two numbers are the same, indicating nothing happened in memory in-between the two calls.
Looking at the bytecode compiled locally:
$ ./slua-compile memtest.luau
Function 0 (??):
1: print(gcinfo())
GETIMPORT R0 1 [print]
GETIMPORT R1 3 [gcinfo]
CALL R1 0 -1
CALL R0 -1 0
4: print(gcinfo())
GETIMPORT R0 1 [print]
GETIMPORT R1 3 [gcinfo]
CALL R1 0 -1
CALL R0 -1 0
5:
RETURN R0 0
nothing at all happens in between the two print statements. No allocation, no string concatenation, nothing
I can't grab the bytecode for the simulator-compiled script, but it's clearly doing something differently