-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[benchmark] Add benchmark for [AnyHashable: Any] with String keys #20067
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 smoke test |
@swift-ci please benchmark |
Build comment file:Performance: -O
Performance: -Osize
Performance: -Onone
How 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 regressions before you merge the PR. Noise: Sometimes the performance results (not code size!) contain false alarms. Unexpected regressions which are marked with '(?)' are probably noise. If you see regressions which you cannot explain you can try to run the benchmarks again. If regressions still show up, please consult with the performance team (@eeckstein). Hardware Overview
|
Hm; these failures are unrelated. |
@swift-ci test |
1 similar comment
@swift-ci test |
@swift-ci smoke test os x platform |
@swift-ci smoke test linux platform |
@lorentey Since these are new benchmarks, would you mind if I lowered the base workload on them by a factor of 10 and used the CamelCase naming convention, when I make this change? ( |
Feel free to change the iteration multiplier! Please don't change the names, though -- the underscore visually separates the data structure from the operation, and merging the two components together will make it harder for me to find the particular result I'm interested in. Is there a technical reason to require camel case? |
No technical reason. Just adherence to Swift Naming Guidelines. |
Benchmark names aren't APIs. If anything, I'd actually prefer to name microbenchmarks directly after the member signature they test. E.g., I'd name the lookup test here something like |
Well, most of the SBS currently consists of composite benchmarks. Individual method tests are in absolute minority. IMO the driving factor for naming should be for them to fit into reports in GitHub without causing the table to scroll horizontally ;-) Going from what's currently in there, UpperCamelCase is the prevailing convention, with absolute minority with one underscore mixed in… The rule I've put in the |
To me, any separator would be much preferable to Benchmark names are very similar to test names -- some of them are hierarchical and we should have a rule that accommodates that. The dot would work very well! Names like I think shell limitations aren't really relevant -- it's not too difficult to quote names, especially if we stay away from using apostrophes. |
@lorentey I'm working on cleaning this up. I've lowered the workload to 50 keys. But there is also about 50% setup overhead (run Can you please help me identify the source of setup overhead in |
@lorentey ping ^^ |
I don't see anything obvious, either. Does it disappear if you do a couple iterations of the benchmark loop in the setup function? |
Nope. I did up to 5x blackHole warmups in the setup, not helping... |
@inline(never) | ||
public func run_DictionaryOfAnyHashableStrings_insert(_ n: Int) { | ||
precondition(keys.count > 0) | ||
for _ in 0 ... n { |
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.
Hah! Finally cracked the mystical setup overhead: one extra iteration. The loop should be either 1...n
or 0..<n
. I'll fix this in a next Janitor Duty legacyFactor
pass.
We don't have adequate benchmark coverage for
AnyHashable
. This PR adds a couple of benchmarks for the most important usecase,[AnyHashable: Any]
withString
keys. (An undecoratedNSDictionary
gets imported as such into Swift.)