Files
quininerandGitHub dfaa5d5ddf refactor(ast): Introduce flexible serialization encoding for AST (#11100)
**Description:**

Following our previous discussion, I am trying to introduce a
self-describing serialization encoding for ast to replace
https://github.com/swc-project/swc/pull/11069 .

Since `serde` is currently used for json serialization, it is hard to
modify serde to support both json and binary encodings (due to the
`untagged` and `flatten` attr). So I made our own `Encode` and `Decode`
proc macro, which also facilitate unknown variant support.

<img width="1804" height="1776" alt="benchmark"
src="https://github.com/user-attachments/assets/73e294cd-be88-43a0-a390-fdd24c8f464f"
/>

I've done some simple benchmarks with a modified swc ast, and I believe
we don't have an unacceptable performance loss relative to `rkyv`.
I'm using `cbor4ii` here, which I developed, so I'd prefer it if there's
no performance difference. but it's easy to migrate to `bincode` or
other scheme.

This also introduces an `unknown` feature for `ecma_ast` crate, which
should only be enabled by the wasm plugin to ensure that old plugins can
decode new AST.
2025-10-31 18:06:00 +09:00
..
…