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.

WhipCost.start() / WhipCost.stop(name, started)CLIENTSERVER#

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.

ParamTypeDescription
namestringThe section's line in the table, as 'area: what'
startednumber|nilWhat start() returned
Returns: start(): number|nil; stop(): nothing
CreateThread(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.

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.