bench/

directory
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2026 License: 0BSD

README

EVM benchmarks

EVM separates execution, allocation, and build-cost benchmarks so each number measures one thing cleanly. Compilation, linking, and warm-up always stay outside execution timers. Benchmarks that run scripts against real EDB tables live in the edb repository under internal/evmbench (those include transaction and cursor work—always check each report's sync and indexer settings before comparing).

Quick start

go test ./bench
go test ./bench -run '^$' -bench . -benchmem -cpu 1 -count 5 -benchtime=500ms

Good benchmarking hygiene:

  • Run competing binaries sequentially with identical inputs and alternate their order across rounds.
  • Keep the machine idle—never benchmark alongside other tests or builds.
  • Report slowdowns and unchanged control workloads alongside speedups.
  • Remember scope: a zero-allocation property read does not mean a zero-allocation database transaction.

Reports

Every result belongs to its recorded commit, hardware, and workload. Historical adapter or codec names in older reports do not describe the current public API.

Comparing other interpreters

Pure-Go Lua comparators (Lunar and GopherLua) live in their own Go module so they add no dependencies to evm:

(cd bench/compare/golua && go test -run '^$' -bench . -benchmem -cpu 1 -count 5)

For native C Lua and LuaJIT on macOS (via Homebrew):

LUA_PREFIX="$(brew --prefix lua)" bench/compare/native/run.sh
LUA_PREFIX="$(brew --prefix luajit)" bench/compare/native/run.sh

The native runner builds a temporary executable and times 20,000 invocations per sample (override with SAMPLES and ITERATIONS). Keep in mind that C callbacks and Go callbacks have different crossing costs—always report that boundary alongside the numbers.

Directories

Path Synopsis
internal
mathwork
Package mathwork holds the independent numeric workloads.
Package mathwork holds the independent numeric workloads.
optwork
Package optwork holds workloads compiled by both Go and EVM.
Package optwork holds workloads compiled by both Go and EVM.
workload
Package workload contains shared fixtures for the EVM and Lua benchmarks.
Package workload contains shared fixtures for the EVM and Lua benchmarks.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL