Skip to content

pkg/encoding: reduce allocations - #1

Open
narqo wants to merge 2 commits into
felixge:mainfrom
narqo:decoder-allocs
Open

pkg/encoding: reduce allocations#1
narqo wants to merge 2 commits into
felixge:mainfrom
narqo:decoder-allocs

Conversation

@narqo

@narqo narqo commented Jan 9, 2023

Copy link
Copy Markdown

This is a fairly quick and dirty change, that reduces some obvious allocations :)

name               old time/op    new time/op    delta
AnonymizeTrace-10    33.0µs ± 0%    31.4µs ± 0%   -4.66%  (p=0.008 n=5+5)

name               old alloc/op   new alloc/op   delta
AnonymizeTrace-10    9.82kB ± 0%   10.33kB ± 0%   +5.22%  (p=0.008 n=5+5)

name               old allocs/op  new allocs/op  delta
AnonymizeTrace-10      41.0 ± 0%      19.0 ± 0%  -53.66%  (p=0.008 n=5+5)

(updated the results after running the benchmarks on m1 mac)

@narqo
narqo force-pushed the decoder-allocs branch 2 times, most recently from 1d77c90 to 8c2a15f Compare January 10, 2023 08:44
@narqo narqo changed the title pkg/encoding: reduce allocations in decoder pkg/encoding: reduce allocations Jan 10, 2023
@felixge

felixge commented Jan 13, 2023

Copy link
Copy Markdown
Owner

Hey, thanks for this, I'll take a look when I get a chance. Right now the benchmark is biased towards processing lots of small traces, but for the implementation I probably want to bias towards efficiently processing large traces. I probably need to reflect the benchmark a bit to reflect that.

If I'm reading your code correctly, this would mostly help for processing lots of small traces, right?

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.

2 participants