Skip to content

Conversation

@malkia
Copy link
Owner

@malkia malkia commented Jun 28, 2024

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
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