oxc icon indicating copy to clipboard operation
oxc copied to clipboard

[POC] perf(ast): use pointer instead of slice for identifier names

Open DonIsaac opened this issue 3 months ago • 3 comments

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.

DonIsaac avatar Oct 28 '24 18:10 DonIsaac