swiftlang / swift-testing

A modern, expressive testing package for Swift
Apache License 2.0
1.69k stars 68 forks source link

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

Closed grynspan closed 1 week ago

grynspan commented 1 week ago

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:

grynspan commented 1 week ago

@swift-ci test