Skip to content

Commit 809f826

Browse files
committed
add CLI performance comparison: jjq native-image vs jq 1.8.1
hyperfine benchmarks on 14MB production file. jq's C parser is ~36% faster on parse-dominated CLI workloads. jjq wins on identity round-trip (15% faster serialization). Both have sub-2ms startup. Key insight: jjq's optimizations (interning, zero-alloc queries, bytecode VM) are designed for the library use case (parse once, query many), not CLI one-shot execution.
1 parent fd76728 commit 809f826

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,22 @@ Parse allocation comparison on the 14MB production file:
294294

295295
jjq achieves the lowest parse allocation through field name interning (shared String instances across repeated schemas), deferred string values (no allocation for untouched strings), and a lightweight open-addressing hash index (flat `int[]` instead of `HashMap` nodes).
296296

297+
### CLI Performance: jjq native-image vs jq 1.8.1
298+
299+
GraalVM native-image comparison on the 14MB production file (hyperfine, best of 3+ warmup runs):
300+
301+
| Test | jq 1.8.1 | jjq (native) | Notes |
302+
|------|----------|--------------|-------|
303+
| Startup (`'.' /dev/null`) | 1.4 ms | 1.7 ms | Both sub-2ms |
304+
| Field access (`.user`) | 122 ms | 168 ms | Parse-dominated |
305+
| Deep field (`.a.b[0].c`) | 122 ms | 168 ms | Parse-dominated |
306+
| Object construction | 123 ms | 168 ms | Parse-dominated |
307+
| **Identity round-trip** (parse + serialize) | 245 ms | **213 ms** | **jjq 15% faster** |
308+
309+
For CLI one-shot usage, jq 1.8.1's C parser is ~36% faster on parse-dominated workloads. jjq wins on full round-trips (parse + serialize) due to faster serialization. The native-image binary is 15 MB vs jq's 36 KB.
310+
311+
**jjq's strength is the library use case** — parse once, query many times. In h5m, a 14MB upload is parsed once and queried with dozens of jq expressions. The interning, zero-allocation queries, and pre-compiled bytecode VM amortize across all queries, achieving 3 ns field access with zero garbage. This is not measurable in CLI one-shot benchmarks where parse time dominates.
312+
297313
## Architecture
298314

299315
```

0 commit comments

Comments
 (0)