Skip to content
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

Merged
merged 1 commit into from
Feb 3, 2022

Conversation

Lukasa
Copy link
Contributor

@Lukasa Lukasa commented Feb 3, 2022

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.

@Lukasa Lukasa added the needs-no-version-bump For PRs that when merged do not need a bump in version number. label Feb 3, 2022
Copy link
Member

@FranzBusch FranzBusch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

//
//===----------------------------------------------------------------------===//

import Foundation
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No.

@Lukasa Lukasa force-pushed the cb-test-copying-bbv-to-array branch from c97159b to cff9e74 Compare February 3, 2022 08:16

for _ in 0..<1_000 {
var copy = Array(data)
count &+= copy.readableBytes
Copy link
Contributor

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.
@Lukasa Lukasa force-pushed the cb-test-copying-bbv-to-array branch from cff9e74 to 4e9c5ae Compare February 3, 2022 09:06
@glbrntt glbrntt enabled auto-merge (squash) February 3, 2022 09:29
@glbrntt glbrntt merged commit 3a3e6cb into apple:main Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-no-version-bump For PRs that when merged do not need a bump in version number.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants