rslint / rslint

A (WIP) Extremely fast JavaScript and TypeScript linter and Rust crate
http://rslint.org
MIT License
2.67k stars 79 forks source link

Benchmarks Against SWC? #86

Open shadowtime2000 opened 3 years ago

shadowtime2000 commented 3 years ago

Hi,

This looks like a really cool project and I am wondering if you have benchmarks of your parser against SWC.

RDambrosio016 commented 3 years ago

Currently i don't have concrete benchmarks because i am still developing and optimizing the parser, however, i know it performs about as fast as swc's parser, going faster or slower depending on file size. This is pretty much expected because swc produces a basic AST, rslint's parser produces events which are then converted to a (lossless!) tree. Event processing is relatively slow therefore the parser is a lot slower on large files than it is on moderately sized files. As for the lexer, it is significantly faster than swc's lexer, mostly because it relies on byte-based lexing, while swc is based on chars. You also need to consider the fact that rslint's parser is error tolerant and lossless, both of which add some complexity, memory usage, and overhead.

Overall, id say if you don't need error tolerance and losslessness and just need an AST, use swc, it doesnt have any memory overhead and has much less bugs. Also, swc supports jsx while rslint currently doesn't.

shadowtime2000 commented 3 years ago

So rslint is more for actual stuff like linting and static analysis while SWC is better for just AST manipulation?

RDambrosio016 commented 3 years ago

Pretty much, swc is fantastic for AST manipulation and "abstract" operations because it has things like AST -> str already, additionally, rslint's rowan tree is a bit awkward to mutate (since it is immutable to allow for easy sharing). However rslint excels at static analysis and analyzing the raw tree and things like whitespace, its also error tolerant which is nice.