Esc to clear, Enter to open the best match, click an export to open it in its page
Tools
Timing your loops (WhipCost)
What a loop of yours really costs on a player's PC, without a profiler's overhead. Mark the section with WhipCost, run /whipcost in game, and read the table it prints in F8, most expensive first.
Marks a section to time. Load client_script '@whip_core/lib/cost.lua', and server_script the same for server code. While /whipcost isn't running, start() returns nil and stop() returns at once.
| Param | Type | Description |
|---|---|---|
| name | string | The section's line in the table, as 'area: what' |
| started | number|nil | What start() returned |
Returns:
start(): number|nil; stop(): nothingCreateThread(function()
while true do
local cost = WhipCost.start()
drawCafeMarkers()
WhipCost.stop('mycafe: markers', cost)
Wait(0)
end
end)
Never
Wait() between the two. A run that waited a frame is left out of the table.Running it and reading the table
With developer mode on, type /whipcost (20 seconds) or /whipcost 60 (5 to 120) and play as usual. The server console's whipcost times server sections, by CPU time only.
- us a frame: the section's share of every frame. Read this column. A section that ran under 100 times is marked "rough".
- KB a second: memory made, which the garbage collector then clears. A second table gives it for every resource loading
lib/satellite.luaorlib/cost.lua: the climb you see inresmon. - Calls into whip_core, and how often: one a frame from another resource costs both sides every frame. Then whip_core's own loops.
Collectors pause while it runs, so memory counts are exact. A resource making over 32 MB gets its collector back and its figure stops there; afterwards, collectors catch up, which can cause a small hitch.