Benchmarks
Two forks, three warmups and five 500 ms measurements per method,
GC profiler. Inputs are the fixed, versioned
benchmark-workload-v1.tsv; they are not sampled at
run time. Charts use the recorded scores only: release-baseline
rows and the targeted post-optimization reruns are labelled
separately and never blended into one bar.
Raw data:
results/release-1.2.0/benchmarks/jmh-workload-v1.json
and the targeted optimization reruns
optimization-unknown-compound.json,
optimization-compacted.json,
optimization-compacted-ascii.json and
optimization-compacted-flat-clean.json. Methodology:
docs/benchmarks.md.
Latency by path
Arithmetic mean latency (avgt), lower is better. Rows
marked “targeted rerun” come from the post-release optimization
runs and use their own same-run evo2 reference; the remaining rows
are from the full workload run.
Latency relative to evo-inflector 2.0
Each bar is morphex ÷ evo2 for the same path and run. The dashed marker is parity (1.00×): bars to its left are faster, bars to its right are slower.
Recorded results
All rows exactly as recorded. Rows marked “optimized” or “flattened dispatch” are the targeted reruns; the others are the full workload run.
| Benchmark | Score ns/op | Alloc B/op |
|---|---|---|
| evo2LexicalHit | 118.5 | 121.7 |
| inflectorLexicalHit | 100.7 | 65.7 |
| evo2Compacted (flattened dispatch) | 59.8 | 80.6 |
| inflectorCompacted (flattened dispatch) | 79.4 | 51.4 |
| evo2Unknown | 80.4 | 73.6 |
| inflectorUnknown (optimized) | 608.6 | 48.8 |
| evo2Uppercase | 89.8 | 120.0 |
| inflectorUppercase | 711.4 | 163.6 |
| evo2Compound | 95.8 | 103.2 |
| inflectorCompound (optimized) | 442.7 | 197.6 |
| evo2Unsupported | 78.6 | 113.1 |
| inflectorUnsupported | 384.3 | 377.1 |
| evo2Repeated | 110.9 | 104.8 |
| inflectorRepeated | 81.4 | 17.3 |
| evo2AnalyzeEquivalent | 327.7 | 269.6 |
| inflectorAnalyze | 387.4 | 236.7 |
| inflectorRulesOnly | 1,032.4 | 910.2 |
Allocation per operation
Normalized GC allocation per operation
(gc.alloc.rate.norm), lower is better. Allocation is
where this library is consistently ahead, including on paths that
are slower in time.
Compacted path, stage by stage
The compacted regular-word path after each retained change. Stages are separate targeted runs, not a same-session A/B; the final gray bar is the evo2 reference measured in the same clean run as the final stage.
| Stage | ns/op | B/op | Change vs previous |
|---|---|---|---|
| Release baseline | 456.4 | 395.4 | — |
| After compound fast path | 187.3 | 51.4 | 2.44× faster |
| After ASCII shape path | 105.0 | 51.4 | 1.78× faster |
| After flattened dispatch | 79.4 | 51.4 | 1.32× faster |
| evo2 2.0, same clean run | 59.8 | 80.6 | reference |
Allocation fell from 395.4 to 51.4 B/op with the compound fast path and stayed there; the ASCII and flattened-dispatch stages changed latency only. The current path is 1.33× slower than evo2, down from 1.78× after the ASCII path, 3.09× after the compound fix, and 4.36× in the release baseline. Allocation remains lower than evo2.
Concurrency
Four threads sharing one immutable instance, throughput over the mixed workload, same run.
Startup and footprint
| Startup (load + first call) | 718–726 ms |
| First pluralize after load | 2.5–3.6 ms |
| Retained heap after GC | ~18.2 MiB (19.08 MB) |
| Cold 50k unseen-token calls | 428–449 ms |
| lexicon entries | 147,338 |
| Concurrent throughput, 4 threads | 4.82M vs evo2 20.91M ops/s (4.34× lower) |
The instance is immutable and thread-safe, but concurrency throughput is lower in the same run. Startup was slower than the historical 426 ms median; figures are not mixed across runs.
TypeScript port on Node.js
A separate runtime, harness and workload from everything above.
These numbers come from
morphex-ts/scripts/bench.ts on an Intel Core
i5-12500H with Node.js 24.20.0: one warm-up pass, seven timed
samples, median reported, first sample dropped. Five runs are
shown as ranges.
They are not comparable to the JMH results above
and are not a cross-language speed claim.
| Workload | Delta engine | Full engine | Rules-only |
|---|---|---|---|
Repeated lexical word (child) |
111–119 ns | 269–280 ns | 130–139 ns |
Repeated rule word (cat) |
112–118 ns | 174–188 ns | 104–116 ns |
Repeated compound (mother-in-law) |
258–289 ns | 434–457 ns | 358–378 ns |
| Distinct fixture lemmas (4,000 words) | 354–432 ns | 1,006–1,057 ns | 327–355 ns |
analyze() repeated (die) |
258–278 ns | 421–441 ns | 221–228 ns |
The delta engine parses its four artifact sections and inserts
them directly into an open-addressed hash index over the 124,883
keys at load time, so a rule-only word such as
cat costs one hash and a short probe before the rules
run. The original four-section code measured 673–678 ns; a merged
binary search measured 286–293 ns; the hash index measures 112–118
ns (about 5.7–6.0× faster than the original). The index costs 1
MiB of memory; provider construction measures 50–51 ms end to end
(32–33 ms parsing, 17–19 ms building the index), down from 77–81
ms before the construction changes. It is built lazily on first
use. The full engine is now slower on these paths (174–188 ns) but
carries complete diagnostics, and rules-only ships no data at all.
| Artifact | Raw | Gzip |
|---|---|---|
| Delta lexicon (124,883 entries) | 1,962,900 B | 562,893 B |
| Full lexicon (147,338 entries) | 3,707,556 B | 785,131 B |
| Membership sidecar (340,726 hashes) | 1,817,208 B | 1,333,152 B |
| Browser demo bundle (full lexicon) | 3,735,118 B | 794,141 B |
Method, build commands and the full discussion: morphex-ts/BENCHMARKS.md.
Method at a glance
| Field | Value |
|---|---|
| JDK / Maven / JMH |
Temurin 21.0.13 · 3.9.9 · 1.37 (-f 2 -wi 3 -i 5 -w 500ms -r 500ms -prof gc)
|
| Compare |
org.atteo:evo-inflector:2.0, same run and
inputs
|
Reproduce
./mvnw -q -pl inflector-benchmarks -am package
java -jar inflector-benchmarks/target/benchmarks.jar \
-f 2 -wi 3 -i 5 -w 500ms -r 500ms -prof gc \
-rf json -rff results/release-1.2.0/benchmarks/jmh-workload-v1.json
The workload covers lexical hits, compacted regular words, unknown inputs, uppercase inference, compounds and unsupported inputs. Historical corpus-only runs are preserved but are not comparable to this fixed-category workload.