Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Benchmarks Against SWC? #86

Open
shadowtime2000 opened this issue Feb 19, 2021 · 3 comments
Open

Benchmarks Against SWC? #86

shadowtime2000 opened this issue Feb 19, 2021 · 3 comments

Comments

@shadowtime2000
Copy link

Hi,

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

@RDambrosio016
Copy link
Collaborator

RDambrosio016 commented Feb 20, 2021

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
Copy link
Author

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

@RDambrosio016
Copy link
Collaborator

RDambrosio016 commented Feb 20, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants