Skip to content

Don't use Synchronization.Atomic for deliverExpectationCheckedEvents. #666

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

Merged
merged 1 commit into from
Sep 6, 2024

Conversation

grynspan
Copy link
Contributor

@grynspan grynspan commented Sep 6, 2024

This PR replaces the new use of Atomic<Int> with a Locked<Int> in the implementation of deliverExpectationCheckedEvents. Why? Because we're running into some environments where the Synchronization module isn't available (e.g. older host macOSes) and this is simpler. The performance profile is comparable: on my system, running the repeatedlyExpect() test takes 0.55s instead of 0.49s to call #expect() 1,000,000 times, so it's still a significant win over the implementation we had earlier.

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

…ts`.

This PR replaces the new use of `Atomic<Int>` with a `Locked<Int>` in the
implementation of `deliverExpectationCheckedEvents`. Why? Because we're running
into some environments where the Synchronization module isn't available (e.g.
older host macOSes) and this is simpler. The performance profile is comparable:
on my system, running the `repeatedlyExpect()` test takes 0.55s instead of 0.49s
to call `#expect()` 1,000,000 times, so it's still a significant win over the
implementation we had earlier.
@grynspan grynspan added bug 🪲 Something isn't working darwin 🍎 macOS, iOS, watchOS, tvOS, and visionOS support performance Performance issues swift-6.1 labels Sep 6, 2024
@grynspan grynspan self-assigned this Sep 6, 2024
@grynspan
Copy link
Contributor Author

grynspan commented Sep 6, 2024

@swift-ci test

@grynspan grynspan merged commit 2e9df4f into main Sep 6, 2024
3 checks passed
@grynspan grynspan deleted the jgrynspan/no-atomic-for-delivered-check branch September 6, 2024 15:18
grynspan added a commit that referenced this pull request Sep 6, 2024
…edEvents`. (#667)

**Explanation:** Drops use of `Atomic<Int>` which is giving us some
grief in some build environments where the Synchronization module isn't
available.
**Scope:** 6.0 branch
**Issue:** N/A
**Original PR:** #666
**Risk:** Low
**Testing:** Existing coverage.
**Reviewer:** @briancroom @suzannaratcliff @stmontgomery
@grynspan grynspan added this to the Swift 6.1 milestone Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working darwin 🍎 macOS, iOS, watchOS, tvOS, and visionOS support performance Performance issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants