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

[SDK] Added reserve for spans array in BatchSpanProcessor. (#2724) #49

Merged
merged 1 commit into from
Jun 28, 2024

Conversation

malkia
Copy link
Owner

@malkia malkia commented Jun 28, 2024

  • Added reserve for spans array in BatchSpanProcessor.

    Added reserve for spans array in BatchSpanProcessor.

    Helps to allocate the amount of memory needed for number of records so that dynamic memory allocation doesn't happen in the consume method.

    .push_back() reallocates memory each time the method is called.

    Using .reserve() would avoid memory reallocation as already the memory is allocated.

    References:
    https://cplusplus.com/reference/vector/vector/push_back/
    https://cplusplus.com/reference/vector/vector/reserve/

  • Added reserve for spans array in BatchLogProcessor.

Added reserve for spans array in BatchLogProcessor. Same as previously done for BatchSpanProcessor

  • Update batch_log_record_processor.cc

  • Update batch_span_processor.cc

  • Update sdk/src/logs/batch_log_record_processor.cc

Fixes # (issue)

Changes

Please provide a brief description of the changes here.

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

* Added reserve for spans array in BatchSpanProcessor.

    Added reserve for spans array in BatchSpanProcessor.
    
    Helps to allocate the amount of memory needed for number of records so that dynamic memory allocation doesn't happen in the consume method.
    
    .push_back() reallocates memory each time the method is called.
    
    Using .reserve() would avoid memory reallocation as already the memory is allocated.
    
    References:
    https://cplusplus.com/reference/vector/vector/push_back/
    https://cplusplus.com/reference/vector/vector/reserve/

* Added reserve for spans array in BatchLogProcessor.

Added reserve for spans array in BatchLogProcessor. Same as previously done for BatchSpanProcessor

* Update batch_log_record_processor.cc

* Update batch_span_processor.cc

* Update sdk/src/logs/batch_log_record_processor.cc
@malkia malkia merged commit 052a22c into malkia:main Jun 28, 2024
1 of 2 checks passed
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