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

Migrate to Swift concurrency. #675

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

allevato
Copy link
Member

I ran the old version and the new version in release mode for 15 iterations over about 400 source files and got the following mean wall times:

  • lint: 9.71 sec (Dispatch) vs. 9.83 sec (Concurrency)
  • format: 20.61 sec (Dispatch) vs. 20.79 (Concurrency)

Even though the means for Concurrency are slightly higher, Student's t-test yielded p = 0.416 (lint) and p = 0.439 (format) which aren't low enough to claim they're significant.

This replaces `Dispatch.concurrentPerform` with a task group. One
benefit of this approach is that we don't need to know the number
of iterations that we want ahead of time. We can start tasks during
the initial iteration over the `FileIterator` instead of eagerly
expanding it first; this should potentially improve behavior for
invocations that cover very large directories recursively,
especially when they're on slower storage like a network drive.
Instead of having `StderrDiagnosticPrinter` internally manage its
own synchronization (which currently uses a Dispatch queue), turn
`DiagnosticsEngine` into an actor that processes diagnostics from
an `AsyncStream`. When rules emit findings, they are enqueued in
the stream, and a single task iterates over them to ensure that
individual diagnostic handlers don't need to synchronize their own
activity.
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.

1 participant