Skip to content

0.1.0

Latest

Choose a tag to compare

@mackoj mackoj released this 13 Nov 23:27
· 6 commits to main since this release
04bfd2d

Highlights

Faster, with fewer allocations. Measured with the new package-benchmark suite on a 1.4 MB document (p50, Apple silicon):

Benchmark 0.0.4 0.1.0
Replace all 5,000 prices with $..price 419 ms 10.0 ms
Remove the books a filter selects 111 ms 2.4 ms
8 RFC 9535 queries 117 ms 15.3 ms
8 Jayway queries 66.7 ms 9.3 ms
$..author 9.9 ms 1.3 ms
Parse the JSON text 26.4 ms 7.9 ms
Print it as JSON 15.3 ms 9.8 ms
  • Mutations change containers in place, so replace, remove and map no longer copy an array on every write.
  • values(in:), firstValue(in:), matches(_:), filters and functions no longer build normalized paths they discard; nodes(in:) still returns them.
  • Regexes in match, search and =~ are compiled once per query instead of once per node.
  • The JSON parser and printer work on runs of bytes instead of one scalar at a time.
  • OrderedDictionary iterates without hashing, and small objects (8 members or fewer) need no index.

API: JSONValueDecoder and JSONValueEncoder are now Sendable. Nothing is removed or changed: diagnose-api-breaking-changes reports no breaks against 0.0.4.

Project:

  • A landing page.
  • Benchmarks/, a package-benchmark suite with a profiling script.
  • Architecture rules on swift-llm-check that check the coding standards in CI.
.package(url: "https://github.com/mackoj/swift-jsonpath.git", from: "0.1.0")

What's Changed

  • Check the mechanical coding standards with swift-llm-check by @mackoj in #7
  • Benchmarks, and 2–40× faster mutation, queries and JSON parsing by @mackoj in #8
  • Add a landing page on GitHub Pages by @mackoj in #9

Full Changelog: 0.0.4...0.1.0