v0.5.0: empty default features + TOON spec v3.1 + faster float emit - #20
Merged
Conversation
added 2 commits
June 2, 2026 13:34
…er float emit CLI / packaging: - default features now empty so `cargo install etoon` builds the binary without pulling in pyo3; the Python wheel enables `python` explicitly via maturin (pyproject [tool.maturin] features). Drops the redundant `--no-default-features` from CI / release / cargo publish. Spec v3.1 alignment (default on; breaking output change → 0.4.1 → 0.5.0): - empty arrays emit canonical `[]` / `key: []` (was `[0]:`); a bare empty array *element* keeps `- [0]:` per SPEC §9.2. - control chars U+0000–U+001F escape to `\uXXXX` (lowercase hex), keeping named `\n \r \t`. - key folding now restarts at any multi-key object (SPEC §13.4), not just the top level, without re-folding past flattenDepth / sibling-collision stops. - encode fixtures synced to the official toon-format/spec v3.1 set (+7 cases); key-folding.json keeps etoon's sigil-prefix extensions + 2 deep-fold cases. Performance: - write_number drops the redundant to_string() probe before write_float; float-heavy emit ~1.7x faster (probe formatted every float twice). Tests / tooling: - 17 Rust unit tests pinning number canonicalization, empty-array forms, control escaping, and depth folding; CI runs `cargo test`. - benches/compare.py + ts_bench.mjs: etoon vs toons / py-rtoon / TS SDK, speed + byte-identical parity.
…chmark Replaces the single hand-timed 50-doc snapshot with the benches/compare.py numbers across four payload shapes, comparing etoon (PyO3) vs toons / py-rtoon / TS SDK on both speed and byte-identical parity (py-rtoon's `0.0` spec deviation is now visible). Reproduce section points at `benches/compare.py` (+ the `.[bench]` extra) instead of an ad-hoc shell loop. Both EN and zh-TW.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Three independent threads, landed together as v0.5.0 (the spec-alignment changes are breaking output changes, hence the minor bump).
1.
cargo installno longer needs--no-default-featuresdefaultfeatures are now empty, so the CLI binary builds without pulling in pyo3. The Python wheel enablespythonexplicitly via maturin ([tool.maturin] features). Removes the redundant--no-default-featuresfrom CI, release, andcargo publish.2. TOON spec v3.1 alignment (default on)
[]/key: [](was[0]:); a bare empty-array element keeps- [0]:per SPEC §9.2.\uXXXX(lowercase), named\n \r \tpreserved.flattenDepth/ sibling-collision stops.toon-format/specv3.1 (+7 cases);key-folding.jsonkeeps the sigil-prefix extensions + 2 deep-fold regression cases.Both
empty_array_bareandescape_controlsare options (defaulttrue); passfalsefor legacy output.3. Faster float emit (~1.7x)
write_numberdropped a redundantto_string()probe that formatted every float twice beforewrite_float.Verification
cargo test.benches/compare.py(+ Node sidecar) compares etoon vs toons / py-rtoon / TS SDK on speed and byte-identical parity.MSG | etoon