-
Notifications
You must be signed in to change notification settings - Fork 10.5k
benchmarks: make benchmarks more stable #18096
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
Changes from all commits
1a7bee5
8876c24
f6c24a0
f1afba1
50db6f1
bd43d54
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,7 @@ class RefArray<T> { | |
// elements should be a nop. | ||
@inline(never) | ||
func genEnumArray() { | ||
_ = RefArray<Int?>(3) | ||
blackHole(RefArray<Int?>(3)) | ||
// should be a nop | ||
} | ||
|
||
|
@@ -53,13 +53,13 @@ struct S<T> { | |
} | ||
@inline(never) | ||
func genStructArray() { | ||
_ = RefArray<S<Int>>(S(x:3, y:4)) | ||
blackHole(RefArray<S<Int>>(S(x:3, y:4))) | ||
// should be a nop | ||
} | ||
|
||
@inline(never) | ||
public func run_ArrayOfGenericPOD(_ N: Int) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one is 50% overhead according to my measurements. I guess some There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't see any problems here, but it's a good idea to add blackHoles here. |
||
for _ in 0...N { | ||
for _ in 0..<N { | ||
genEnumArray() | ||
genStructArray() | ||
} | ||
|
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'm confused about all these benchmarks that have the
// should be a nop
comments. What are they supposed to measure?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 think it means that it's expected that the optimizer removes everything. I'm not sure if this makes sense.
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.
In general, it's better to replace such benchmarks (which only test if the optimizer removes everything) by a lit test.
Uh oh!
There was an error while loading. Please reload this page.
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.
My point exactly: