lukeed/tidyPublic

perf: find comment tokens fast

Finding the token before a ; copied every comment of the file into a
new vector, once per child that decorate compared, and once per
statement the printer measured: quadratic in comments. The token
search reads the parser's comment list in place, and decorate keeps
each node's sorted children for the comments after it. A 2 MB
bundle formats in 51 ms instead of 161 ms.
LELuke Edwards authored
a28d34fPatch
Parent529d89c
1 file changed+25-18
StackedSplit
crates/tidy/src/js/ast/comments.rs+25 −18