Edit: Dbub pushed several improvements - many thanks
Not sure if this constitutes a bug so I thought it would be best to get some more information here. Apologising in advance.
I’m still new to coding and, aside from very limited JS experience, have only used cfxlua.
I looked through gottfried’s lua fork and really liked what I saw, on top of reading through the 5.4 reference manual.
From what I’ve seen it should perform faster, but it seems like there may be problems? Until I’m performing a lot of actions every tick, resource usage is higher.
Information
I’ve been checking performance every now and then for around a month, with both canary and production builds. I use the recommended server artifact, so right now 4394. Home hosted using Windows, tested with essentially no resources enabled.
Empty lua file
Memory improvements aside, the server uses slightly less CPU and the client uses more (yes I realise how negligible this is). I’ll include some more screenshots and code below.
Empty threads
CreateThread(function()
while true do
Wait(0)
end
end)
for i=1, 20 do
CreateThread(function()
while true do Wait(0) end
end)
end
Iterator
CreateThread(function()
while true do
Wait(0)
for i=1, 10000 do
local var = var
end
end
end)
Once we’re actually doing a lot with those threads we actually start to see improvements, but nobody needs to iterate 10,000 times per tick.
Playing with different numbers, it wasn’t until around 550 iterations that 5.4 started to get ahead on both client and server.
If you’re making a resource with no, or very slow, threads then the benefits will definitely start to show, otherwise you can make large single-resource servers to maximise the benefits but then you’re better off using JS/TS.
I considered a “thread manager” resource and exporting everything I want to run on an interval to that to create supersized-threads but I don’t know if that would cause hell to break loose.