bananabench Reference
Module defined in `lua/console/bananabench.lua`. Core physics benchmarking module that measures beam simulation throughput (MBeams/s) and real-time performance percentage across multiple vehicles.
Module defined in lua/console/bananabench.lua. Core physics benchmarking module that measures beam simulation throughput (MBeams/s) and real-time performance percentage across multiple vehicles.
Functions/Exports
M.physics(vehicles, vehicleMin, vehicleMax) (exported as benchPhysics)
Main benchmark entry point. Spawns vehicles and measures physics performance.
- vehicles - table of vehicle directory names (default:
{'pickup'}) - vehicleMin - starting vehicle count (default: 1)
- vehicleMax - max vehicle count (default:
VehiclesToTestor 40) - Returns a results table with per-vehicle test data (MBeams/s, % realtime, timing)
M.getAllVehicles()
Scans /vehicles directory and returns list of all vehicle names (excludes /vehicles/common).
myBenchStep(testVehicle, vehLPackData, n, steps) (global)
Runs a single benchmark step: spawns n vehicles, runs physics update loop, returns spawn time and minimum frame time.
- Disables GC and JIT during measurement for consistency
- Checks for physics instability after each run
benchLog(level, origin, msg, newline) (global)
Custom log handler that caches log messages and tracks max severity (warn/error). Filters out A/D/S level messages.
loadVehicle(vehicleDir) (local)
Loads a vehicle via jbeam/loader stage1 and returns lpack-encoded data.
formatRes(res) (local, nested inside benchPhysics)
Formats a single result entry (MBeams/s and % realtime) for table output row. Nested helper within the output print loop.
Configuration
physicsFPS = 2000- physics simulation ratephysicsSteps = 100- max physics steps per update (do NOT increase beyond 100)gfxSteps = 200- graphics frame steps per benchmark rundefaultVehicleCount = 40- default max vehicles to testversion = '0.5'
Usage
local bench = require("lua/console/bananabench")
local res = bench.physics() -- benchmark default vehicle (pickup), 1-40 count
local res = bench.physics({'pickup', 'pigeon'}, 1, 20) -- custom vehicles/range
local vehicles = bench.getAllVehicles() -- get all available vehiclesInternal Notes
- Uses
HighPerfTimerfor precise timing measurements - Calls
setPowerPlanMaxPerformance()/restorePowerPlan()to ensure consistent CPU performance - Spawns vehicles at 300m intervals to avoid collisions
- Warmup round of 5 steps before actual measurement
- Collects minimum frame time across all
gfxStepsiterations - Results include: MBeams/s, % realtime, spawn time, execution time per vehicle count
- Outputs ASCII banana art on completion
bananabench-xml Reference
Script defined in `lua/console/bananabench-xml.lua`. Runs bananabench on a predefined set of vehicles and exports results as XML, suitable for CI/CD performance reporting.
benchphysics Reference
Script defined in `lua/console/benchphysics.lua`. Simple legacy physics scaling benchmark that measures per-frame delay as vehicle count increases, outputting results to CSV.