Reference

Performance

Inspect evlog benchmark workloads, output settings, and bundle measurements before estimating the cost of your logging configuration.

The cost of logging depends on the fields you collect, serialization, redaction, output, and delivery. The repository includes microbenchmarks for those operations, but an event-construction measurement is not an end-to-end request cost or a delivery guarantee.

evlog vs alternatives

The comparison suite runs libraries with different output paths. At commit 5bd1c127, the configurations are:

LibraryWork included in an emitted recordWork excluded
evlogEvent construction with silent: trueConsole serialization, console writes, remote drains
PinoJSON serialization and synchronous write to /dev/nullRemote transport and indexing
WinstonJSON formatting and a no-op writable streamRemote transport and indexing
ConsolaProcessing through a no-op reporterReporter serialization and delivery

These configurations help inspect individual code paths. They do not isolate the cost of choosing one library over another. /dev/null avoids a stored file, but its write still includes a system call.

Results

Earlier versions of this page ranked silent: true construction against serialized output as though they performed equivalent work. Those rankings are withdrawn. The suite's request-lifecycle scenario also compares one accumulated evlog event with four Pino or Winston records, so output count and serialization differ at the same time.

Generate results for the checked-out version using the commands below. Keep the raw results alongside the commit, lockfile, Node.js version, hardware, and logger configuration. A result without that context is not a production throughput promise.

What is the "wide event lifecycle"?

The scenario creates a logger, adds three groups of fields, and emits a final event. A multi-record version writes after each group and at completion. Moving from four records to one reduces the event count by 75% for that scenario. It does not establish a universal reduction in bytes, CPU time, or cost.

Pino and Winston can also emit one final object. For a library comparison, measure that case too. The log cost guide separates event-based and byte-based billing and lets you use your own traffic assumptions.

What affects event construction?

log.set() merges fields into the pending context. emit() selects severity, applies sampling and configured redaction, and prepares the final event. With JSON console output enabled, serialization runs during output. A drain can serialize again for its own protocol.

The amount and shape of data matter: nested objects, error stacks, redaction patterns, and plugin hooks exercise different paths. Timing a small event without output does not price a large event with custom enrichment and export.

When evlog might not win

A Pino transport can run in a worker, separating transport processing from the calling thread. Initial record serialization still happens in the logger. Winston formats and transports, or a Consola reporter, may already implement the exact output your application needs. Keeping that configuration can be preferable to migrating it.

There is no supported claim here that evlog wins every other workload. Measure throughput and application latency with your destination, payloads, and delivery policy. Include queued work and final flushing, not just the time it takes to enqueue an event.

What it costs on one real request

Measure the complete path you deploy:

  1. Run a representative handler with enabled: false to establish a baseline without logging.
  2. Enable event construction, the redaction rules and enrichers you use, and the actual output configuration.
  3. Exercise successes, errors, and the largest expected context. Record request latency distributions as well as throughput.
  4. Include batching, retries, queue limits, and shutdown or background-delivery behavior. Confirm records reach the destination.

Do not add means from unrelated microbenchmarks and label their sum a measured request cost. Work may overlap, take different branches, or happen asynchronously. Network delivery and backend indexing need their own measurements.

How evlog 2 and evlog 3 compare

evlog 3 builds and emits events faster than evlog 2.36 and 2.37. log.set() runs 1.7 to 2.9 times faster than in 2.36.0, emit 1.4 to 2.2 times faster, and a request costs 8.4 µs against 9.4 µs. evlog 3 also keeps everything the evlog 2 line gained since 2.32.0: requests about 2.5 times cheaper, an install half the size, serverless functions released milliseconds after their request instead of seconds, and a drain that stops retrying a backend that rejects a batch or asks it to wait. If you run evlog 2.32 or older, upgrading to the latest evlog 2 already gets you that part.

Measurement2.32.02.36.02.37.0evlog 3
Request without a drain23.8 µs9.4 µs10.0 µs8.4 µs
Request with a drain pipeline25.3 µs9.7 µs11.2 µs9.3 µs
Serverless request26.2 µs10.9 µs12.2 µs10.8 µs
bench/core suite, geometric mean against 2.36.0not run1×0.99×1.22×
CPU at 5,000 requests/s with waitUntil29%20%21%20%
Serverless function kept alive after its request, p99 at 2,000 requests/s9.8 s9.9 s11 ms12 ms
Same, p50, when the backend takes 300 ms6.2 s6.2 s0.66 s0.66 s
Shutdown flush when the backend answers 40015 s15 s38 ms36 ms
Install size1.98 MB0.93 MB0.97 MB0.93 MB

A few paths do more work in evlog 3, each to deliver something the earlier versions did not. Redaction now also checks values for credentials, and costs 10 to 13% more than in 2.36.0. When the backend is down, a serverless app uses about 8% of a core at 1,000 requests/s against 3%, because each request end sends the events the pipeline holds before the function freezes, instead of leaving them for a batch timer that may never fire. evlog/pipeline grows from 2.0 kB to 7.0 kB gzip, as bench/scripts/size.ts measures it, to carry the retry rules, drop reporting, and request-end flush.

These numbers come from one machine (a 4-core Intel Xeon at 2.90 GHz, Node.js 26.13.1, Linux) on November 21, 2026. 2.32.0, the last release before work on evlog 3 started, and 2.36.0 come from npm. 2.37.0 is main at 104923e1, and evlog 3 is the v3 branch at 268ff9ab, which has changes newer than 3.0.0-beta.3. Request rows are the time per request over 200,000 sequential requests that set fields and finish, without the handler's own work. Each load scenario ran twice. The bench/core, log.set(), emit, and redaction figures come from an earlier run the same day, against v3 before the pipeline changes in #1212, which do not touch the logger. Your numbers depend on your payloads, redaction, and destination, so measure the configuration you deploy. To compare a published release with your checkout:

Terminal
npm pack evlog@2.36.0 && mkdir -p /tmp/evlog-2.36.0 && tar xzf evlog-2.36.0.tgz -C /tmp/evlog-2.36.0
pnpm --filter evlog build
cd packages/evlog
pnpm bench:load --pkg 2.36.0=/tmp/evlog-2.36.0/package --pkg head=. --repeat 2

Bundle size

An emitted entry-point file is not the size of the application bundle that imports it. Shared chunks and selected exports contribute to the final size. The server core, evlog/http, framework integrations, and drain adapters also target different uses.

Build the entry points you plan to import and measure the resulting bundle. For a comparison with another library, keep the bundler, target, minification, compression, versions, and imported capabilities consistent. A server bundle cannot establish which browser logger is smaller.

Detailed benchmarks

SuiteQuestion it helps answer
bench/core/How do context size, merging, emission, and errors affect construction?
bench/comparison/What do the explicitly configured alternative workloads cost?
Other files under bench/What do the corresponding enrichers, middleware, sampling, or pipeline operations cost?

Read each setup before interpreting a result: silent output, disabled drains, and reused fixtures can change the work included. Sampling and Configuration describe the controls you should match to your application.

Methodology & trust

Can you trust these numbers?

The benchmark source is available for inspection. A trustworthy comparison additionally needs equivalent work, versioned inputs, and reproducible output. The current comparison setup does not meet the equivalent-output condition.

When publishing a run, record the commit, dependency versions, runtime, CPU, operating system, warmup and measurement settings, payload, redaction, and destination. Repeat it to expose variation. State whether the number measures construction, serialization, queued delivery, or completed delivery.

Run it yourself

From a checkout with dependencies installed, run the suite once rather than leaving it in watch mode:

Terminal
cd packages/evlog
pnpm exec vitest bench --run
pnpm exec vitest bench --run bench/comparison/
pnpm exec tsx bench/scripts/size.ts

Vitest writes benchmark results to bench/results.json. Keep that output with the run metadata when sharing a measurement. The size script measures its declared imports, so inspect them before applying the result to your own bundle.