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

pkg/query/flamegraph_arrow: Cast strings to bytes #3441

Merged
merged 1 commit into from
Jul 12, 2023

Conversation

metalmatze
Copy link
Member

Arrow casts this internal but apparently copies the string to bytes. This codes uses the stringToBytes helper which does not copy using the unsafe.StringData API.

name      old time/op    new time/op    delta
Query-24     440µs ± 6%     398µs ± 8%  -9.59%  (p=0.032 n=5+5)

name      old alloc/op   new alloc/op   delta
Query-24     470kB ± 0%     460kB ± 0%  -2.12%  (p=0.008 n=5+5)

name      old allocs/op  new allocs/op  delta
Query-24     2.79k ± 0%     2.53k ± 0%  -9.25%  (p=0.008 n=5+5)

Arrow casts this internal but apparently copies the string to bytes. This codes uses the stringToBytes helper which does not copy using the `unsafe.StringData` API.

```
name      old time/op    new time/op    delta
Query-24     440µs ± 6%     398µs ± 8%  -9.59%  (p=0.032 n=5+5)

name      old alloc/op   new alloc/op   delta
Query-24     470kB ± 0%     460kB ± 0%  -2.12%  (p=0.008 n=5+5)

name      old allocs/op  new allocs/op  delta
Query-24     2.79k ± 0%     2.53k ± 0%  -9.25%  (p=0.008 n=5+5)
```
@metalmatze metalmatze requested a review from a team as a code owner July 12, 2023 15:04
Copy link
Member

@brancz brancz left a comment

Choose a reason for hiding this comment

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

nice!

@metalmatze metalmatze enabled auto-merge (squash) July 12, 2023 15:30
@metalmatze metalmatze merged commit 8147049 into main Jul 12, 2023
@brancz brancz deleted the flamegraph-arrow-append-stringtobytes branch July 13, 2023 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants