Skip to content

Improve performance of excluded files filter#6342

Merged
SimplyDanny merged 6 commits intomainfrom
exclude-performance
Dec 7, 2025
Merged

Improve performance of excluded files filter#6342
SimplyDanny merged 6 commits intomainfrom
exclude-performance

Conversation

@SwiftLintBot
Copy link

SwiftLintBot commented Nov 16, 2025

1 Warning
⚠️ Big PR
19 Messages
📖 Building this branch resulted in a binary size of 26850.74 KiB vs 26842.8 KiB when built on main (0% larger).
📖 Linting Aerial with this PR took 0.8 s vs 0.75 s on main (6% slower).
📖 Linting Alamofire with this PR took 1.06 s vs 1.05 s on main (0% slower).
📖 Linting Brave with this PR took 6.87 s vs 6.82 s on main (0% slower).
📖 Linting DuckDuckGo with this PR took 22.27 s vs 22.22 s on main (0% slower).
📖 Linting Firefox with this PR took 11.0 s vs 10.99 s on main (0% slower).
📖 Linting Kickstarter with this PR took 7.72 s vs 7.69 s on main (0% slower).
📖 Linting Moya with this PR took 0.42 s vs 0.42 s on main (0% slower).
📖 Linting NetNewsWire with this PR took 2.32 s vs 2.27 s on main (2% slower).
📖 Linting Nimble with this PR took 0.63 s vs 0.67 s on main (5% faster).
📖 Linting PocketCasts with this PR took 6.99 s vs 7.1 s on main (1% faster).
📖 Linting Quick with this PR took 0.45 s vs 0.37 s on main (21% slower).
📖 Linting Realm with this PR took 3.28 s vs 3.26 s on main (0% slower).
📖 Linting Sourcery with this PR took 1.82 s vs 1.8 s on main (1% slower).
📖 Linting Swift with this PR took 4.21 s vs 4.19 s on main (0% slower).
📖 Linting SwiftLintPerformanceTests with this PR took 0.34 s vs 16.97 s on main (97% faster).
📖 Linting VLC with this PR took 1.1 s vs 1.08 s on main (1% slower).
📖 Linting Wire with this PR took 17.47 s vs 17.42 s on main (0% slower).
📖 Linting WordPress with this PR took 11.43 s vs 11.4 s on main (0% slower).

Generated by 🚫 Danger

@SimplyDanny SimplyDanny mentioned this pull request Nov 21, 2025
@SimplyDanny SimplyDanny force-pushed the exclude-performance branch 2 times, most recently from 884c016 to 0fcf778 Compare November 30, 2025 18:23
@SimplyDanny SimplyDanny marked this pull request as ready for review November 30, 2025 23:06
@SimplyDanny SimplyDanny force-pushed the exclude-performance branch 4 times, most recently from dc556ac to 1bb433c Compare December 7, 2025 12:57
The current algorithm is like "collect all included files and subtract all excluded files".
Collecting all included and all excluded files relies on the file system. This can become slow
when the patterns used to exclude files resolve to a large number of files.

The new approach only collects all lintable files and checks them against the exclude patterns.
This can be done by in-memory string-regex-match and does therefore not require file system accesses.
The new implementation also no longer traverses directories that already match an exclude pattern.

(cherry picked from commit 152355e)

# Conflicts:
#	Source/SwiftLintFramework/Configuration/Configuration+LintableFiles.swift
@SimplyDanny SimplyDanny merged commit ac701c0 into main Dec 7, 2025
27 checks passed
@SimplyDanny SimplyDanny deleted the exclude-performance branch December 7, 2025 14:58
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

Successfully merging this pull request may close these issues.

2 participants