Runtime Performance

Heap held by each package across a full lifecycle, and the CPU time and allocations each job costs.

Each benchmark builds the adapters, processes a batch of jobs and calls close(). The memory phase measures the heap the lifecycle holds; the profile phase samples CPU time and allocations while the jobs are created and processed.

Your stack

Showing every backend. Pick the ones you use to hide the rest on every benchmark page; the pick is saved in this browser.

Test setup

  • Machine
    Apple M1 Pro
  • Runtime
    Node.js v24
  • Infrastructure
    Docker Desktop on macOS
    Databases and pub/sub servers run in containers, so every round trip crosses the VM bridge.
  • Servers
    PostgreSQL 18, SQLite 3.53, MySQL 26, MariaDB 13, Redis 8, NATS 2
  • Work step
    100 jobs for memory, 2,000 for profiles
    Each phase runs in its own child process, after a discarded warmup run of the same lifecycle.

Memory

A discarded warmup run first compiles the code paths and loads lazy modules; every number is then measured against a baseline taken after the warmup, from heap snapshots rather than process.memoryUsage().heapUsed, which counts V8 fragmentation and free pages as retention.

Measurements

  • Setup
    Heap allocated by the state adapter, notify adapter, client and worker runner once built, before any job runs.
  • In-flight peak
    Heap at its peak while 100 chains are created and processed.
  • Live JS retained
    Live JS object graph left after close(), compared with the baseline. This answers whether Queuert leaks heap.
  • JIT code retained
    V8-compiled code the process keeps. Node modules never unload, so this is a one-time cost of loading the code, not a leak per lifecycle.

Setup

KB
  • notify-redis
    ~70
  • notify-postgres
    ~75
  • notify-nats
    ~75
  • notify-ipc
    ~100
  • state-in-process
    ~100
  • state-sqlite
    ~100
  • state-postgres
    ~65
  • state-mysql
    ~80
  • state-mariadb
    ~80
  • state-redis
    ~120
  • dashboard
    ~110
  • otel
    ~95

In-flight peak

KB
  • notify-redis
    ~300
  • notify-postgres
    ~295
  • notify-nats
    ~270
  • notify-ipc
    ~240
  • state-in-process
    ~275
  • state-sqlite
    ~170
  • state-postgres
    ~125
  • state-mysql
    ~200
  • state-mariadb
    ~190
  • state-redis
    ~240
  • dashboard
    ~285
  • otel
    ~275

Live JS retained

KB
  • notify-redis
    ~20
  • notify-postgres
    ~15
  • notify-nats
    ~15
  • notify-ipc
    ~10
  • state-in-process
    ~5
  • state-sqlite
    ~10
  • state-postgres
    ~20
  • state-mysql
    ~20
  • state-mariadb
    ~20
  • state-redis
    ~20
  • dashboard
    ~10
  • otel
    ~10

JIT code retained

KB
  • notify-redis
    ~135
  • notify-postgres
    ~125
  • notify-nats
    ~100
  • notify-ipc
    ~95
  • state-in-process
    ~140
  • state-sqlite
    ~105
  • state-postgres
    ~25
  • state-mysql
    ~90
  • state-mariadb
    ~80
  • state-redis
    ~165
  • dashboard
    ~135
  • otel
    ~120

Reading the results

Live JS retained is a one-time amount: about 5-20 KB for every package. Running three lifecycles instead of one leaves the same amount. JIT code retained grows with the code paths a package exercises, so packages that run more queries keep more. Neither grows per job or per lifecycle.

Driver and connection cost (a node-redis client, a postgres.js or mysql2 pool, a NATS connection) lives outside Queuert's lifecycle. The benchmark prints it per run but leaves it out of these numbers.

CPU and allocations

The CPU profiler samples every 100 µs and the heap profiler samples allocations, including objects already collected, only while the work step runs. Each sample is attributed to the file of the function it lands in. Time spent waiting on a database or broker is left out.

Categories

  • Queuert core
    The queuert package, including the in-process state and notify adapters.
  • Adapter
    The Queuert package under test, such as @queuert/postgres or @queuert/otel.
  • Dependencies
    Database drivers, pub/sub clients and the OpenTelemetry SDK.
  • Runtime
    Node.js internals, V8 builtins and garbage collection.

CPU per job, Queuert core

µs
  • notify-redis
    ~85
  • notify-postgres
    ~83
  • notify-nats
    ~79
  • notify-ipc
    ~40
  • state-in-process
    ~39
  • state-sqlite
    ~37
  • state-postgres
    ~84
  • state-mysql
    ~92
  • state-mariadb
    ~93
  • state-redis
    ~66
  • dashboard
    ~46
  • otel
    ~48

CPU per job, Adapter

µs
  • notify-redis
    ~9
  • notify-postgres
    ~9
  • notify-nats
    ~9
  • notify-ipc
    ~5
  • state-in-process
    ~0
  • state-sqlite
    ~30
  • state-postgres
    ~32
  • state-mysql
    ~122
  • state-mariadb
    ~113
  • state-redis
    ~211
  • dashboard
    ~0
  • otel
    ~0

CPU per job, Dependencies

µs
  • notify-redis
    ~34
  • notify-postgres
    ~62
  • notify-nats
    ~28
  • notify-ipc
    ~0
  • state-in-process
    ~0
  • state-sqlite
    ~18
  • state-postgres
    ~192
  • state-mysql
    ~367
  • state-mariadb
    ~346
  • state-redis
    ~47
  • dashboard
    ~0
  • otel
    ~12

CPU per job, Runtime

µs
  • notify-redis
    ~120
  • notify-postgres
    ~115
  • notify-nats
    ~78
  • notify-ipc
    ~14
  • state-in-process
    ~11
  • state-sqlite
    ~128
  • state-postgres
    ~245
  • state-mysql
    ~440
  • state-mariadb
    ~436
  • state-redis
    ~165
  • dashboard
    ~15
  • otel
    ~18

Allocated per job

KB
  • notify-redis
    ~82.3
  • notify-postgres
    ~83.8
  • notify-nats
    ~71.2
  • notify-ipc
    ~35.0
  • state-in-process
    ~35.1
  • state-sqlite
    ~41.8
  • state-postgres
    ~131.5
  • state-mysql
    ~243.3
  • state-mariadb
    ~241.8
  • state-redis
    ~226.1
  • dashboard
    ~51.9
  • otel
    ~65.9

Job type registries

The registry measurements run the same lifecycle on the in-process state and notify adapters with each job type registry, creating and processing chains whose input is an order with a nested customer and three line items. defineJobTypes is the baseline: it passes values through without running anything.

The CPU chart shows the time spent inside the schema library. On top of it, every createJobTypes registry adds about 1 µs of Queuert core CPU per job to call the encoders and decoders and check that every encoded value is JSON-serializable. The Zod and TypeBox adapters compile their schemas once with z.compile and TypeCompiler.Compile, and ArkType compiles its types itself. The codec adapters process the same JSON input, so they show the cost of the codec path, not of a transform.

Schema library CPU per job

µs
  • defineJobTypes
    ~0.0
  • Zod
    ~0.1
  • Valibot
    ~10.5
  • TypeBox
    ~0.0
  • ArkType
    ~0.6
  • Zod codec
    ~3.4
  • superjson codec
    ~38.0

Allocated per job by registry

KB
  • defineJobTypes
    ~52.0
  • Zod
    ~53.8
  • Valibot
    ~59.9
  • TypeBox
    ~52.5
  • ArkType
    ~53.5
  • Zod codec
    ~57.9
  • superjson codec
    ~86.6

Reproduce

From benchmarks/runtime-performance, with Docker running. Its README covers the method, the per-step output and the profile files for Chrome DevTools or speedscope.

Terminal

pnpm --filter benchmark-runtime-performance start
pnpm --filter benchmark-runtime-performance start:state-postgres
pnpm --filter benchmark-runtime-performance start:state-sqlite --profile
pnpm --filter benchmark-runtime-performance start:validation --profile
esc

Search guides, integrations and every exported symbol.

↑ ↓ to navigate↵ to open