-
Notifications
You must be signed in to change notification settings - Fork 634
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
Add benchmarks for copying BBV to Array. #2037
Conversation
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
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
import Foundation |
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.
NIT: Do we need Foundation here?
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.
No.
c97159b
to
cff9e74
Compare
|
||
for _ in 0..<1_000 { | ||
var copy = Array(data) | ||
count &+= copy.readableBytes |
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.
copy.count
?
Motivation: Protocols like Sequence have "private" hooks that can be implemented to provide fast-paths for some operations. We missed a few on BBV, and I'd like to add them. This is one use-case where they can help. Modifications: - Add an allocation-counter benchmark and a runtime benchmark for copying BBV to Array. Result: We have some benchmarks.
cff9e74
to
4e9c5ae
Compare
Motivation:
Protocols like Sequence have "private" hooks that can be implemented to
provide fast-paths for some operations. We missed a few on BBV, and I'd
like to add them. This is one use-case where they can help.
Modifications:
copying BBV to Array.
Result:
We have some benchmarks.