Esc to clear, Enter to open the best match, click an export to open it in its page
Building on WHIP

Testing and performance

Tools for trying your resource before players do, and for measuring what it costs on the player's game and the server.

Testing

To testUse
Your inventory screen, without the gamenode whip_core/dev/inventory-preview/preview.js my_inventory_ui runs it in Chrome with sample scenes (the renderer seat)
A Director card or scenarioTestDirectorCard(type, props, { player = source }), TestDirectorScenario (Director cards)
Something done to another player, alonePass { charId = n } for a second character of yours, then log in as them to see it
Two players at onceTwo FiveM clients on one PC, same account, different characters. Turn off Config.BlockOwnCharacterTransfers on a test server to move money between them
Dying, healing, a broken car/w → Kill Me, Restore Player Cores, Repair Vehicle (Dev Tools)
What your events did/whip → System → Monitor: each SecureEvent call, the reason for a refusal, and how long your handler took
Errors you missedwhiperrors in the server console (F8 in developer mode); GetErrorLog in code

Measuring#

WhereToolTells you
Player's game/whipcost (developer mode)Microseconds per frame for each timed section, and each resource's memory. Time your own loops with WhipCost.start() / WhipCost.stop('my loop', t) (client_script '@whip_core/lib/cost.lua'), never with a Wait between them
Player's gameMeasureFrames({ seconds })FPS, the worst 1%, and frames over 33 and 50 ms: compare with your resource started and stopped
Serverwhipcost [seconds] in the consoleThe same for server sections marked with WhipCost (server_script '@whip_core/lib/cost.lua'), by CPU time
Server/whip → System → MonitorHow long each SecureEvent and SecureCallback handler took, database waits included
Eitherprofiler record 500, then profiler viewEvery resource's time per frame in Chrome's performance view. With setr whip_profiling 1, whip_core's handlers are named by event. Captures inflate costs about five times: compare captures, not budgets

The usual cost is a loop running every frame (Wait(0)). Wait on an event instead, and check the loops you must keep with /whipcost.

What an export costs#

Cheapest first. Call the first two as often as you need; the rest when something happens, never every frame.

CostFor exampleMeans
MemoryHasItem, GetItemCount, IsPlayerClockedOn, GetPlayerJob, GetBalance after its first readMicroseconds
A copyGetPlayer, GetVehicle, StoreReadFrom memory, but the table is serialised on its way to you. Keep what you need rather than re-reading every frame
Sends to a gameNotifyPlayer, ShowBlip, ShowPlayerText, SetPlayerMetadataNetwork traffic: fine per action, wrong in a loop over every player
Waits on the databaseEnsure*, bank reads, ChargePlayer, PayPlayer, AddItem, SetVehicleDataMarked WAITS: milliseconds. Call from a thread or handler, and re-read after
Waits on the other side or the playerServer Progress, SkillCheck; client Callback, ResolveVehicle, InputWAITS too: a round trip (200 ms at 200 ms ping), or as long as the player takes