Hello :android-wave: Happy to share that Ghost Se...
# feed
j
Hello 👋 Happy to share that Ghost Serializer 1.3.0 is out: This isn't an incremental bump from 1.2.7 — it's a rewrite of what "Ghost" ships as an artifact, plus the biggest decode-throughput jump in the project's history. Highlights • One runtime, three wire formats. JSON, YAML, and Proto3 JSON now live in a single
ghost-serialization
artifact.
ghost-yaml
,
ghost-yaml-ktor
, and
ghost-protobuf
are gone. • Decode throughput up to 1.2 GB/s. A rewritten decode hot path (in-order field prediction + SWAR scanning) pushed every channel well past 1.2.7 • Hitting for the first time some native C++ parser speeds (while fully hydrating typed Kotlin models) !! • Kotlin/Wasm everywhere.
ghost-api
,
ghost-serialization
,
ghost-ktor
, and the new Ghost Playground now ship
wasmJs
targets alongside JVM/Android/iOS. • New Ghost Playground— Compose Multiplatform (JVM + Wasm) site with a live JSON/YAML/Proto Studio and a browser speed test vs kotlinx.serialization and Moshi. • Two silent data-corruption bugs fixedin the streaming reader and the WebFlux NDJSON decoder. Full release: github.com/juanchurtado1991/ghost-serializer/…/v.1.3.0 Let's keep pushing the limits of KMP! 🚀
🚀 4
K 1
o
Nice work with the benchmark! Just in case: 1. safari 2. chrome (macOS, MacBook Pro 16, M2 Max) Looks like WebKit Wasm support is much less performant...
j
Hey Oleg thanks for testing it out really appreciate it— reproduced it on my own M2 Pro Likely cause: my decode path uses 8-byte SWAR bitwise scanning, which V8 and the JVM JIT optimize well but JSC's Wasm backend may not. Tracking issue with details: github.com/juanchurtado1991/ghost-serializer/issues/16
👍 1
a
Did you try running against the YAML test suite? https://matrix.yaml.info/ YAML is hard, so I'm curious how well it performs :)
👀 1
b
YAML is hard
YAML looks like it has been specified by people who never in their life even contemplated writing a parser, let alone have any experience writing parsers.
a
Half-agree, but also the main creator loves overcomplicating things https://yamlscript.org/
👀 3
b
WAT!?
😆 3
j
@Adam S Not yet against the official test suite — just filed github.com/juanchurtado1991/ghost-serializer/issues/17 to track that properly, since I don't want to claim spec compliance without real pass/fail numbers against the matrix. What I do have right now: fixture-only throughput comparison against kaml — Ghost decodes ~12x faster (1.2 vs 14.8 µs/op) and encodes ~7x faster (0.8 vs 5.8 µs/op) on a small user fixture. That's speed, not spec coverage — the yaml-test-suite question is still open, will report back on it once it's wired in. Reproduce it yourself:
./gradlew :ghost-benchmark:benchmarkYaml -PskipTests
(clone the repo first, obviously 🙂). Fast dev profile is
benchmarkYamlFast
but it's noisier — the numbers above are from the full profile.
a
Spec compliance doesn't matter too much, most parsers get some things wrong, and even if they do sometimes it's for good reasons (e.g. preventing recursive data causing crashes). In case it helps snakeyaml-engine-kmp uses the test-suite. https://github.com/krzema12/snakeyaml-engine-kmp/tree/main/src/commonTest/kotlin/it/krzeminski/snakeyaml/engine/kmp/test_suite
👀 1
b
> Spec compliance doesn't matter too much Are you haunted by the ghost of Jon Postel? 😂
😂 1
j
😂 haunted by Postel, or just haunted by whoever decided anchors and merge keys were a good idea. Either way "Ghost" felt appropriate before I even knew the pun potential
Thanks Adam that is very helpful
b
if a spec nudges implementors towards violating it, then the spec is cursed and I can't think of even a single redeeming argument. Sure, does not matter when it is widely used, but implementing is a royal pain and interop between implementations is hell in all its Technicolor glory. Hence: mad respect for putting yourself through this @Juan Hurtado, and godspeed!
agree 1
p
b
Thanks @Paulo Cereda, I hate it!
😅 1
j
Haha thank you both for the support and the link (what an absolute cursed gem of a website!). Definitely worth suffering through the spec a bit if it saves everyone else the headache down the road. Cheers ! 🍻
👋 just FYI — github.com/juanchurtado1991/ghost-serializer/issues/18 — ran the YAML decoder against the official yaml-test-suite and found a real gap (plus one nasty bug: tiny malformed input could OOM the process, already fixed). If you're planning to use YAML specifically, I'd hold off until 1.3.1 — should be a lot more reliable. JSON/Proto3 paths aren't affected by any of this. (Thanks again for the suggestion @Adam S)