JMH 1.37 · fixed workload v1

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.

Repeated lookup 81.4 ns/op 1.36× faster · evo2 110.9
Exact lexical hit 100.7 ns/op 1.18× faster · evo2 118.5
Repeated allocation 17.3 B/op 6.1× lower · evo2 104.8
Compacted regular 79.4 ns/op 1.33× slower · evo2 59.8
Unknown token 608.6 ns/op 7.57× slower · evo2 80.4

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.

ns/op · lower is better
evo-inflector 2.0 morphex
Compacted regular targeted rerun · flattened dispatch
59.8
79.4
Repeated lookup release baseline
110.9
81.4
Exact lexical hit release baseline
118.5
100.7
Unsupported input release baseline
78.6
384.3
Diagnostics (analyze) release baseline · evo2 has no equivalent API
327.7
387.4
Compound targeted rerun · optimized
95.8
442.7
Unknown token targeted rerun · optimized
80.4
608.6
Uppercase inference release baseline
89.8
711.4
Bars share a 0–800 ns axis; printed values are the recorded scores, so every bar is drawn to the same scale. Rows are ordered by morphex latency.

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.

ratio to evo2 · lower is better
faster than evo2 slower than evo2
Repeated lookup release baseline
0.73×
Exact lexical hit release baseline
0.85×
Diagnostics (analyze) evo2 has no equivalent API
1.18×
Compacted regular targeted rerun
1.33×
Compound targeted rerun
4.62×
Unsupported input release baseline
4.89×
Unknown token targeted rerun · optimized
7.57×
Uppercase inference release baseline
7.92×
Dashed marker: 1.00× parity (evo2). Ratios are point estimates from the recorded scores, not same-session A/B confidence intervals.
Measured claim: repeated lookup is 1.36× faster (81.4 vs 110.9 ns) and exact lexical hits are 1.18× faster (100.7 vs 118.5 ns). The optimized unknown and compound paths are 1.49× and 1.13× faster than the release baseline, but remain 7.57× and 4.62× slower than evo2; compacted is 1.3× slower after flattening the rule dispatch, and uppercase and unsupported remain up to 7.9× slower. The optimized rows are separate targeted reruns. No general speedup is claimed.

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.

B/op · lower is better
evo-inflector 2.0 morphex
Repeated lookup release baseline
104.8
17.3
Unknown token targeted rerun · optimized
73.6
48.8
Compacted regular targeted rerun · flattened dispatch
80.6
51.4
Exact lexical hit release baseline
121.7
65.7
Uppercase inference release baseline
120.0
163.6
Compound targeted rerun · optimized
103.2
197.6
Diagnostics (analyze) release baseline · evo2 has no equivalent API
269.6
236.7
Unsupported input release baseline
113.1
377.1
Bars share a 0–400 B/op axis; printed values are the recorded scores. Rows are ordered by morphex allocation.

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.

compacted regular · ns/op · lower is better
morphex stage evo2 reference
Release baseline full workload run
456.4
After compound fast path −59.0% · targeted rerun
187.3
After ASCII shape path −43.9% · targeted rerun
105.0
After flattened dispatch −24.3% · targeted rerun
79.4
evo2 2.0, same clean run reference · 1.33× faster than this library
59.8
Bars share a 0–500 ns axis. Reduction percentages are relative to the previous stage; only the final evo2 bar was measured in the same run as its adjacent morphex bar.
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.

M ops/s · higher is better
evo-inflector 2.0 reference
20.91 M
morphex thread-safe, but more allocation and probing per call
4.82 M
Bars are scaled to 21 M ops/s; values are printed. This is a 4.34× lower throughput in the same run, not a claim about scaling.

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.

Node.js · V8 · not JMH

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

Fixed inputsVersioned workload v1: lexical hits, compacted words, unknown, uppercase, compounds, unsupported.
JMH run2 forks · 3 warmups · 5 measurements · 500 ms each.
MeasureAverage latency plus normalized GC allocation per operation.
RecordJSON receipt, same-run evo2 reference, no cross-run mixing.
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.