census-instrumentation / opencensus-go

A stats collection and distributed tracing framework
http://opencensus.io
Apache License 2.0
2.05k stars 326 forks source link

Reduce allocations #1204

Closed boekkooi-fresh closed 4 years ago

boekkooi-fresh commented 4 years ago

Hello, First of thank you for taking the time to view this PR and your work on opencensus!

While trying to find a performance issue on a service I noticed that Span.lruAttributesToAttributeMap was allocating a bit more often then I was expecting. To reduce the amount of allocation I now provide the length of the source slice/map as the capacity as the new map.slice.

googlebot commented 4 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

boekkooi-fresh commented 4 years ago

@googlebot I signed it!

googlebot commented 4 years ago

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

rghetia commented 4 years ago

@boekkooi-fresh thank you for finding the issue and fixing it.

boekkooi-fresh commented 4 years ago

No problem :smile: and thanks for the quick merge.