github repo:
geis-rbx
“oh, to optimize things that dont really need to be optimized” IPA: /ɡɛʃ/ …is an idiosyncratic taboo, whether of obligation or prohibition, similar to being under a vow or curse, yet the observance of which can also bring power and blessings. an extremely straightforward open-source function benchmarking project with a simple single-table interface |
---|
geis-rbx is a standalone repository used in the open-source Roblox place: /ɡɛʃ/ - Roblox
about
geis-rbx uses Jobs.luau, a single-table interface for simplicity and fast benchmarking, and is outlined by the JobTable
luau type:
--- game/StarterGui/Geis/Jobs
export type JobTable = {
Header: string; -- histogram header
Work: { [string]: () -> () }; -- table of functions to benchmark {[Name]: fn}
RefreshRate: number; -- histogram refresh rate
Cycles: number; -- # of data points to draw the histogram
}
the linked game is a sandboxed version of the default Baseplate, stripped of unnecessary instances, default scripts, and settings that might skew benchmark results during runtime
within the Studio place is a Toolbox
folder (game/ReplicatedStorage/Toolbox)
, which is meant to house developer-made instances for easy referencing/access should any benchmark require them
- by default, the Toolbox contains a
BasePart
andR6
/R15
rigs
benchmarking
- functions are timed using
os.clock()
everyRunService.RenderStep
- times are stored in a first-in, first-out queue
- results are represented as a histogram, partitioned by percentiles of 10
- histogram intervals are represented in microseconds (μs)
- the x-bounds of the histogram are defined as
[0, max(functionTimes)]
- the y-bounds of the histogram are defined as
[0, max(functionFrequencies)]
example usage & result
[!WARNING]
because work functions are bound toRunService.RenderStep
, benchmarking will only work in Play (F5) mode
---a JobTable benchmarking different ways to arrive at Vector3 (0, 0, 0)
{
Header = "99 ways to Vector3(0, 0, 0)";
Work = {
["Vector3.zero"] = function()
return Vector3.zero
end;
["Vector3.new(0, 0, 0)"] = function()
return Vector3.new(0, 0, 0)
end;
["Vector3.one - Vector3.one"] = function()
return Vector3.one - Vector3.one
end;
};
RefreshRate = 1 / 15;
Cycles = 5000;
}