Skip to main content

Benchmarker

The files of bench/visual/ time the same work in each library with the Benchmarker plugin in Roblox Studio: jecs 0.11.0 and mErCS in every file, and ecr 0.9.0 in the four basic benchmarks that jecs ships with (spawn, despawn, insertion, query). The place of benchmarker.project.json holds the libraries (the Wally dev packages and src/) and these files; Development explains how to open it.

Compare the medians (the 50th percentile): Benchmarker's "Average" is the midpoint of the minimum and the maximum. The numbers of the CLI, measured in isolated processes, are on the pages of jecs, ecr and 1.3.0 and 1.2.0.

FileWhatLibraries
spawn.bench.luau1000 entities with 4 componentsjecs, mErCS, ecr
despawn.bench.luaudelete 1000 entities with 4 components and a tagjecs, mErCS, ecr
insertion.bench.luau8 components into 500 existing entitiesjecs, mErCS, ecr
query.bench.luau10 passes of a 4-component query over 4096 entities: for-in, query:each for mErCS, a view for ecrjecs, mErCS, ecr
batch.bench.luauadd and remove a tag on 1000 of 2000 entities: batch operations against a jecs collect-and-change loopjecs, mErCS
pairs.bench.luau100 parents with 10 ChildOf children that also target a parent through a relation, then the parents are deletedjecs, mErCS
query_churn.bench.luaua query case: a tag of the query toggled on 1 or 100 entities before each passjecs, mErCS
query_empty.bench.luaua query case: 100 passes of a query that never matchesjecs, mErCS
query_read4.bench.luaua query case: 4 values read per match (80 000 entities)jecs, mErCS
query_scattered.bench.luaua query case: a 4-component query over 50 000 entities scattered by churnjecs, mErCS
query_wildcard.bench.luaua query case: (*, T) with a pair toggled before each passjecs, mErCS
remove.bench.luauremove one of 5 components from 1000 entitiesjecs, mErCS

Screenshots​

Benchmarker v7.3.1, Edit mode, native code, 1000 calls of each function, with jecs 0.11.0, mErCS 1.0.0 and, in the four basic benchmarks, ecr 0.9.0. They were captured with 1.0.0 and not again for 1.0.1, 1.1.0, 1.2.0 and 1.3.0, whose numbers come from the CLI (the pages of jecs, ecr and the previous release). Roblox compiles a script to native code only when it has the --!native comment: the modules of jecs and mErCS have it, the module of ecr does not, so ecr runs as bytecode here. The CLI numbers of ecr compile all three to native code (--codegen) and also give the interpreter.

The medians (the 50th percentile) of the screenshots below, per call:

Benchmarkjecs 0.11.0mErCS 1.0.0ecr 0.9.0
spawn845 µs532 µs947 µs
despawn415 µs312 µs934 µs
insertion917 µs628 µs798 µs
query0.110 ms0.130 ms; query:each 0.057 ms1.950 ms
batch485 µs53 µs—
pairs7.636 ms1.891 ms—
query_churn, toggle 1155 µs154 µs—
query_churn, toggle 100247 µs227 µs—
query_empty6 µs2 µs—
query_read41.613 ms0.815 ms—
query_scattered125 µs76 µs—
query_wildcard799 µs344 µs—
remove333 µs65 µs—

Benchmarker: spawn

Benchmarker: despawn

Benchmarker: insertion

Benchmarker: query

Benchmarker: batch

Benchmarker: pairs

Benchmarker: query_churn

Benchmarker: query_empty

Benchmarker: query_read4

Benchmarker: query_scattered

Benchmarker: query_wildcard

Benchmarker: remove