-
Notifications
You must be signed in to change notification settings - Fork 87
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
Runtime performance regression compared to XCTest with a factor of 5-10x for certain tests #710
Comments
I have added a simple and self-contained package, while not displaying the same dramatic difference, still is slower by a factor 2. jhansbo@niemann ~/S/MyTests> swift test --filter testInverseNormalUnivariateCDFLoop |
jhansbo@niemann ~/S/MyTests> swift --version |
MyTests.zip |
I would bet a peanut this is fixed by #659. |
@grynspan i did, it is attached in the original description in the middle... :-) |
Oops, missed it. Thanks! |
Yup! |
Duplicate of #659 |
Is it possible to verify this with Xcode Beta 2, 16B5014f?! |
Xcode 16.1 Beta 2 does not include the fix, however it's expected to be available in an upcoming Xcode beta. |
Looks much better in Xcode 16.1 Beta 3! Thanks for that! |
jhansbo@niemann ~/D/MyTests [1]> swift test --filter testInverseNormalUnivariateCDFLoop |
jhansbo@niemann ~/D/MyTests> swift test --filter inverseNormalUnivariateCDFLoop |
jhansbo@niemann ~/D/MyTests> swift test --filter inverseNormalUnivariateCDFLoop -c release |
So while it's really a lot faster it's still slightly slower than XCTest. As far as I can see roughly 40% slower in MyTest for release and 20% for debug builds. |
Description
We've recently ported one of our packages to the new testing infrastructure, and it has been overall smooth - we can see one significant performance regression on the actual runtime of the test and have narrowed it down to the use of #expect in two places - I will provide the test code and timing results and sample of the runtime here, but we can work on providing a reduced case if this does not give enough hints on what the underlying problem can be.
The timing measurements we see are:
Release mode (
swift test -c release
):XCTest:
New Testing:
Debug (
swift test
):XCTest:
New Testing:
New Testing (with commenting out two #expect in the loops in the sample code provided below):
So basically we see a 10x runtime difference in release mode with XCtest winning over the new test framework - and a factor 6 in debug mode. Commenting out the two #expects in the sample below (best guess based on the sample) gave a significant improvement from 164 ---> 98 seconds runtime.
Attaching sample:
Sample.txt
Here is the test code in question for the new testing framework (no changes in the test itself, just using the new framework):
Expected behavior
We expected approximately the same runtime with the new testing framework.
Actual behavior
We saw a 5-10x test runtime regression for certain tests.
Steps to reproduce
No response
swift-testing version/commit hash
Built in with 6.0 release toolchain with Xcode 16
Swift & OS version (output of
swift --version ; uname -a
)swift-driver version: 1.115 Apple Swift version 6.0 (swiftlang-6.0.0.9.10 clang-1600.0.26.2) Target: arm64-apple-macosx15.0 Darwin ice.local 24.0.0 Darwin Kernel Version 24.0.0: Mon Aug 12 20:51:54 PDT 2024; root:xnu-11215.1.10~2/RELEASE_ARM64_T6000 arm64
The text was updated successfully, but these errors were encountered: