RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Bananabench AsyncBananabench CSVBananabench JSONBananabench PrintBananabench XMLBananabenchPhysics BenchmarkBeamConsole Folder OverviewJSON PerformanceConsole MainResave Parts ConfigsServer TestsSimple LoadSimulation TestDynamic Collision TestMain Development TestUnit Tests

UI

Resources

BeamNG Game Engine Lua Cheat SheetGE Developer RecipesMCP Server Setup

// RLS.STUDIOS=true

Premium Mods for BeamNG.drive. Career systems, custom vehicles, and immersive gameplay experiences.

Index

HomeProjectsPatreon

Socials

DiscordPatreon (RLS)Patreon (Vehicles)

© 2026 RLS Studios. All rights reserved.

Modding since 2024

API Referenceconsole

JSON Performance

Script defined in `lua/console/json-performance.lua`. Comprehensive serialization performance benchmark comparing JSON, lpack, lpack binary, and string.buffer encode/decode speeds.

Script defined in lua/console/json-performance.lua. Comprehensive serialization performance benchmark comparing JSON, lpack, lpack binary, and string.buffer encode/decode speeds.


Functions/Exports

No module exports (standalone script). Contains the following local helper functions that run sequentially:

test() (local)

Main orchestrator - discovers .jbeam files, reads them, runs JSON decode benchmark, then calls each serialization test function.

testLpackEncode() (local)

Benchmarks lpack.encode() on all parsed tables, reports packed size and MB/s throughput.

testLpackDecode() (local)

Benchmarks lpack.decode() on lpack-encoded data, reports MB/s throughput.

testLpackEncodeBin() (local)

Benchmarks lpack.encodeBin() (binary variant), reports packed size and MB/s.

strbufEncode() (local)

Benchmarks LuaJIT string.buffer encode on all parsed tables, reports packed size and MB/s.

strbufDecode() (local)

Benchmarks string.buffer decode, reports MB/s throughput.

Tests Performed

  1. File discovery - finds all *.jbeam files in /vehicles
  2. File reading - reads all files into memory, reports size and throughput (MB/s)
  3. JSON decode - parses all jbeam files 6x, measures throughput
  4. lpack encode - encodes parsed Lua tables to lpack format, reports compressed size and throughput
  5. lpack decode - decodes lpack data back, measures throughput
  6. lpack encodeBin - binary variant of lpack encoding
  7. lpack decodeBin - decodes binary lpack
  8. string.buffer encode - LuaJIT string.buffer serialization
  9. string.buffer decode - string.buffer deserialization

Configuration

  • reruns = 6 - number of iterations for each test

Usage

beamng -console lua/console/json-performance.lua

Internal Notes

  • Uses HighPerfTimer for precise measurements
  • Reports MB/s throughput for each serialization method
  • Calls collectgarbage() before each test for clean measurements
  • Compares 4 serialization formats: JSON, lpack, lpack binary, string.buffer
  • Reports total packed sizes to compare compression ratios
  • JIT toggle is commented out but available for testing JIT impact

See Also

  • BeamConsole Folder Overview - Directory overview
  • bananabench-async Reference - Related reference
  • bananabench-csv Reference - Related reference
  • bananabench-json Reference - Related reference
  • Console Commands Guide - Guide

BeamConsole Folder Overview

Console scripts for BeamNG.drive - benchmarks, tests, and utilities run outside the game engine in headless/console mode.

Console Main

Script defined in `lua/console/main.lua`. Bootstrap/initialization script that sets up the Lua environment for console mode, configuring package paths and loading core dependencies.

On this page

Functions/Exportstest() (local)testLpackEncode() (local)testLpackDecode() (local)testLpackEncodeBin() (local)strbufEncode() (local)strbufDecode() (local)Tests PerformedConfigurationUsageInternal NotesSee Also