-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Add profitability check to array-property-opt #29236
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
Conversation
@swift-ci Please Test Source Compatibility |
@swift-ci Please benchmark |
@meg-gupta you also want to do the perf suite. Can give you code-size #s |
@swift-ci test compiler performance |
Performance: -O
Code size: -O
Performance: -Osize
Code size: -OsizePerformance: -OnoneCode size: -swiftlibsHow to read the dataThe tables contain differences in performance which are larger than 8% and differences in code size which are larger than 1%.If you see any unexpected regressions, you should consider fixing the Noise: Sometimes the performance results (not code size!) contain false Hardware Overview
|
Forgot to mention: can you add tests? E.g. including the case where a recursive function is called within the loop. |
Leaving this PR on hold for a bit. I am investigating ways we improve analyses for LICM, which can avoid the need for array-property-opt in some cases. |
@swift-ci test compiler performance |
This change adds additional heuristics to array-property-opt to avoid code size increase in cases where the optimization may not be beneficial. With this change, we do not specialize a loop if it has any opaque function calls or the instruction count computed recursively exceeds a predefined threshold.
Add debugging statements Increase threshold for deeper loop nests
d723153
to
e6c6e8a
Compare
Unfortunately passing multiple CI commands in a single comment doesn’t work, so you need to pass one at a time. |
@swift-ci Test Source Compatibility |
@swift-ci please benchmark |
@swift-ci test compiler performance |
Performance: -O
Code size: -O
Performance: -Osize
Code size: -OsizePerformance: -OnoneCode size: -swiftlibsHow to read the dataThe tables contain differences in performance which are larger than 8% and differences in code size which are larger than 1%.If you see any unexpected regressions, you should consider fixing the Noise: Sometimes the performance results (not code size!) contain false Hardware Overview
|
MapReduce test regressions are because the control flow pattern changes limit some jump threading which in turn limit arc optimizations. The regression is due to additional obj.retain/release calls in the loop. SetTest regressions are because it sees a library function Set.Variant.insert which has a class_method that cannot be devirtualized, even otherwise the AnalysisThreshold will exceed scanning the library function call chain. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no concerns with checking this in if it meets our immediate needs. The implementation looks good. It's clear how it could be extended and generalized in the future if that becomes worthwhile.
If you're not immediately fixing those regressions, then please file a bug to follow up!
@swift-ci smoke test please |
Summary for master fullUnexpected test results, excluded stats for RxCocoa, SwifterSwift, Base64CoderSwiftUI No regressions above thresholds Debug-batchdebug-batch briefRegressed (0)
Improved (0)
Unchanged (delta < 1.0% or delta < 100.0ms) (3)
debug-batch detailedRegressed (0)
Improved (2)
Unchanged (delta < 1.0% or delta < 100.0ms) (208)
Releaserelease briefRegressed (0)
Improved (0)
Unchanged (delta < 1.0% or delta < 100.0ms) (3)
release detailedRegressed (0)
Improved (0)
Unchanged (delta < 1.0% or delta < 100.0ms) (18)
|
@swift-ci Please smoke test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
This change adds additional heuristics to array-property-opt to avoid code size increase in cases where the optimization may not be beneficial. With this change, we do not specialize a loop if it has any opaque function calls or the instruction count computed recursively exceeds a predefined threshold.