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

Small performance and code improvements in signalfx translation #9737

Merged
merged 1 commit into from
May 4, 2022

Conversation

bogdandrutu
Copy link
Member

@bogdandrutu bogdandrutu commented May 4, 2022

  • Avoid lots of small allocations, 1 for every data point by allocating 2 slices one for the objects, one for the pointers.
  • Avoid allocating a "base" data point only for name and type, create helper that is shared across all funcs.
  • Remove duplicate code for calculating dimension set in histogram conversion
  • Fix fragile code that was using for quantiles and buckets dimension append(dims, newDim), which worked correctly only because the cap(dims) == len(dims), hence it force a new allocation of the slice all the time instead of modifying the same memory.

Signed-off-by: Bogdan Drutu bogdandrutu@gmail.com

@bogdandrutu bogdandrutu requested review from a team and djaglowski May 4, 2022 17:29
@bogdandrutu bogdandrutu added the Skip Changelog PRs that do not require a CHANGELOG.md entry label May 4, 2022
* Avoid lots of small allocations, 1 for every data point by allocating 2 slices one for the objects, one for the pointers.
* Avoid allocating a "base" data point only for name and type, create helper that is shared across all funcs.
* Remove duplicate code for calculating dimension set in histogram conversion
* Fix fragile code that was using for quantiles and buckets dimension `append(dims, newDim)`, which worked correctly only because the `cap(dims) == len(dims)`, hence it force a new allocation of the slice all the time instead of modifying the same memory.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
Copy link
Member

@dmitryax dmitryax left a comment

Choose a reason for hiding this comment

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

LGTM

@djaglowski djaglowski merged commit f8a726c into open-telemetry:main May 4, 2022
@bogdandrutu bogdandrutu deleted the fixprom branch May 4, 2022 18:54
djaglowski pushed a commit to djaglowski/opentelemetry-collector-contrib that referenced this pull request May 10, 2022
…-telemetry#9737)

* Avoid lots of small allocations, 1 for every data point by allocating 2 slices one for the objects, one for the pointers.
* Avoid allocating a "base" data point only for name and type, create helper that is shared across all funcs.
* Remove duplicate code for calculating dimension set in histogram conversion
* Fix fragile code that was using for quantiles and buckets dimension `append(dims, newDim)`, which worked correctly only because the `cap(dims) == len(dims)`, hence it force a new allocation of the slice all the time instead of modifying the same memory.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants