oxc
oxc copied to clipboard
[POC] perf(ast): use pointer instead of slice for identifier names
This is a very rough proof-of-concept
Many different AST nodes store both a span and an Atom<'a>
, which has redundant information. Atom<'a>
is a fat pointer storing a length, but we already have that information in the form of Span::offset
.
This POC shows how we can shave a byte off all AST nodes that use both a Span
and an Atom<'a>
(i.e. all identifiers) by using a thin pointer over an Atom<'a>
, then using Span::offset
to get an &str
slice as needed.