Skip to content

Commit 8ad3647

Browse files
authored
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 #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.
1 parent dba23f5 commit 8ad3647

File tree

113 files changed

+2726
-409
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+2726
-409
lines changed

.changeset/chatty-brooms-drop.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
ast_node: major
3+
from_variant: major
4+
swc_atoms: major
5+
---
6+
7+
refactor(ast): Introduce flexible serialization encoding for ast

0 commit comments

Comments
 (0)