Skip to content

purejq 0.1.1 — performance release

Choose a tag to compare

@adam2go adam2go released this 10 Jun 12:16

2–11x faster on common workloads, with conformance unchanged (751/781 of jq's official test suite).

Benchmarks (100k objects, CPython 3.13, M-series)

workload 0.1.0 0.1.1 speedup
field-access stream 19 ms 11 ms 1.7x
filter + count 347 ms 77 ms 4.5x
map + aggregate 48 ms 24 ms 2.0x
group_by 577 ms 121 ms 4.8x
transform + sort 1035 ms 220 ms 4.7x
nested iteration + unique 697 ms 64 ms 10.9x

What changed

  • Native C sorting when sort keys are uniformly strings or numbers — sort, sort_by, group_by, unique, unique_by no longer pay for Python-level comparisons in the typical case
  • Scalar fast path in the comparison core used by ==, <, sort, et al.
  • select, map, and not are now Python-native builtins instead of jq prelude definitions
  • Constant-key object construction ({id, name, x: ...}) skips the generator product machinery
  • .foo and .[] on the current input skip one generator layer

Reproduce with python3 tools/bench.py 100000 (compares against the system jq if installed).