Hey all,
I’ve updated the thread with an explanation on why this module is actually important and good to use. I’ll copy what I appended onto the thread on this post:
Why should I use this, rather than default wait?
The main concern in a lot of Roblox games is that they use the wait function. Like, a lot. This is more bad than you may think. Firstly, this can clog up the task scheduler very easily, and deteriorate the state of your game very quickly. @Maximum_ADHD has demonstrated this issue, as seen here:
Yeah… Pretty bad.
So, how does this module address this? Simple! This module manages and sorts your yields to make sure there’s always only one wait running at once. This leads to making it practically impossible to clog up the task scheduler, saving your game from all the nasty issues.
TLDR This module makes sure your game will always have only one wait running at once, making your game not die from having a filled task scheduler.
This is an issue with having different hardware - I’m unsure regarding your computer specs, but my computer is pretty good and as such can compute more data efficiently, which leads to different results.
I’m unsure at this point. Using this code and putting it in a Script in ServerScriptService to benchmark provides me with the result of 0 failed on this custom wait, and 8302 failed on Roblox’s wait.
To benchmark, replace BenchmarkFunc = CustomWait with BenchmarkFunc = wait
requireing works fine for me, but you need to add a wait(3) before the benchmark - the game hasn’t fully loaded if you run the benchmark directly after the require, which I assume is the issue
This code runs fine and provides the same results as previously, consistently.
local BenchmarkFunc = require(script.ModuleScript)
wait(3)
local NumFailed = 0
for i = 1, 16000 do
coroutine.wrap(function()
local d = BenchmarkFunc(1)
if d > 1.04 then
NumFailed += 1
end
end)()
end
wait(1.1)
print('Num "failed":', NumFailed)
I’m back! This time the problem is the Wait not waiting the proper time, usually waiting longer than usual. Although I’m not advanced enough to understand how this works, I think the problem is relating to coroutines? Putting the wait function in a coroutine seems to cause the whole inaccurate wait time.
Hey, could you make sure you are using the latest version and provide a script which replicates this issue?
I don’t seem to experience any such issues. How long does it yield for?
This module was using a max-heap rather than a min-heap… I’ve no idea how no one noticed this, especially me… All issues should be fixed by now. Sorry for my stupidity
Do you have a repro for this you could send?
EDIT:
Could you make sure you are using the latest version? I’m unsure on how this would exhaust execution time when it’s supposed to do the exact opposite (i.e break the loop):
The loop’s condition is PrioritizedThread - so long PrioritizedThread exists, the loop continues. By setting it to nil it would effectively stop the loop.