Skip to content

Commit

Permalink
Added reserve for spans array in BatchLogProcessor.
Browse files Browse the repository at this point in the history
Added reserve for spans array in BatchLogProcessor. Same as previously done for BatchSpanProcessor
  • Loading branch information
msiddhu authored Jun 27, 2024
1 parent dbcc4a7 commit f91df52
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sdk/src/logs/batch_log_record_processor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ void BatchLogRecordProcessor::Export()
break;
}

// Reserve space for number of records and avoid reallocation of vector.
records_arr.reserve(num_records_to_export);
buffer_.Consume(num_records_to_export,
[&](CircularBufferRange<AtomicUniquePtr<Recordable>> range) noexcept {
range.ForEach([&](AtomicUniquePtr<Recordable> &ptr) {
Expand Down

0 comments on commit f91df52

Please sign in to comment.