So I made PreciseWait, a small module but faster than QuickWait and task.wait by miliseconds. If you ever need a precise waiting function (no one does but), feel free to use my module.
Benchmarking
local PreciseWait=require(game.ServerStorage:WaitForChild("PreciseWait"))
local QuickWait=require(game.ServerStorage:WaitForChild("QuickWait"))
local wait=0.001
local tskw=task.wait
local tests=500
local pw=0
local qw=0
local tw=0
task.wait(2)
for i=1,tests,1 do
pw+=PreciseWait(wait)
qw+=QuickWait(wait)
tw+=tskw(wait)
end
pw/=tests
qw/=tests
tw/=tests
warn(`Expected: {wait}`)
warn(`\nPreciseWait: {pw}\nQuickWait: {qw}\ntask.wait: {tw}`)
local small=math.min(pw,qw,tw)
if small==pw then
warn("PreciseWait wins!")
elseif small==qw then
warn("QuickWait wins!")
elseif small==tw then
warn("task.wait wins!")
end
Output:
Expected: 0.001
PreciseWait: 0.0002008190001361072
QuickWait: 0.016491526800031353
task.wait: 0.016690495199973156
PreciseWait wins!
Module:
PreciseWait - Creator Store
I’ll leave it here if anyone needs it, this is not going to be updated cuz it’s just a small project