3.0.0 → 3.1.0

Blazingly small work at every boundary.

Version 3.1 removes the duplicate strict-envelope pass. Direct objects move faster, JSON parsing stays above five million messages per second, and optional fields work again.

js-message works with bundlers and without a bundler. Bundlers resolve bare imports normally; native browser ESM uses a standard import map with no build or transpilation step.

Recorded results

One million messages. Twenty-one alternating samples.

The published 3.0.0 source and the 3.1.0 candidate run in the same process. Lower elapsed time is faster.

Loading one million object messages: version 3.0.0 took 13.19 milliseconds and version 3.1.0 took 3.89 milliseconds, 3.39 times faster and about 257 million messages per second.
Direct object input benefits most because 3.1 copies available fields without repeating schema checks.
Parsing and loading one million JSON messages: version 3.0.0 took 183.01 milliseconds and version 3.1.0 took 177.53 milliseconds, about 5.63 million messages per second.
Native JSON.parse dominates this path; 3.1 keeps it lean while restoring optional fields.
Constructing one million empty messages: version 3.0.0 took 70.34 milliseconds and version 3.1.0 took 77.37 milliseconds, about 12.9 million retained instances per second.
Empty construction recorded about 12.9 million retained instances per second; the same run also exposes its roughly ten-percent elapsed-time cost instead of hiding it.

Reproduce it

One command, no benchmark dependency.

npm run benchmark

The runner loads the exact 3.0.0 tag from Git, warms both implementations, alternates execution order, requests garbage collection between samples, validates output checksums, and reports the median.

A microbenchmark is evidence, not an application guarantee.

Hardware, runtime flags, payload size, allocation patterns, and surrounding work change throughput. Run the command on the system you plan to ship.