-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Is SwiftSyntax actually faster? #4261
Comments
I've run this on a real project™ and it was even worse: 0.49.1 is ~15% faster than |
I’ll have more to say on this later but, real quick: it’ll be way faster when all rules are on SwiftSyntax, but as long as there’s at least one rule in your ruleset, it’s gonna be a bit more expensive than 100% SourceKit. this is why when benchmarking a single rule, you see a massive speed up, but a slight slowdown when linting all rules. |
I think that visitors are a bit more expensive to run than the regex / SourceKit dictionary lookups, but that the cost of the SourceKit request far outweighs the cost of the SwiftSyntax parser. So yes, if we keep migrating more and more rules to SwiftSyntax, it’ll make SwiftLint slower and slower until eventually when all rules aren’t using SourceKit it’ll be several times faster than we ever could’ve been with only SourceKit. So performance wise, it’ll be worth it in the long run, but until then we still get the correctness benefits. |
I ran a test with the 54 rules we've migrated from SourceKit to SwiftSyntax since 0.49.1 on Lyft's iOS monorepo of 30k Swift files to see how performance is affected when running more than just one rule at a time, and it was 3x faster: 583 files/s with SourceKit, 1691 files/s with SwiftSyntax. |
Nice! Thanks for confirming it ⚡ |
New Issue Checklist
We've been migrating rules to SwiftSyntax and oss-check usually reports that they're faster now, so I was curious about how much faster
main
is.portable_swiftlint
was built usingmake portable_zip
onmain
.swiftlint
was installed with Homebrew and is `0.49.1So
0.49.1
is ~10% faster thanmain
. What am I missing? Maybe the SwiftLint repo is not a good example?The text was updated successfully, but these errors were encountered: