Skip to content

Commit 7c6c555

Browse files
authored
Firestore: Improve efficiency of memory persistence when processing a large number of writes (firebase#13572)
1 parent 3755841 commit 7c6c555

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Firestore/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Unreleased
2+
- [changed] Improve efficiency of memory persistence when processing a large number of writes. (#13572)
3+
14
# 11.2.0
25
- [fixed] Marked all public classes with only readonly properties as `Sendable` to address
36
Swift Concurrency Check warning. (#12666)

Firestore/core/src/local/memory_mutation_queue.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#ifndef FIRESTORE_CORE_SRC_LOCAL_MEMORY_MUTATION_QUEUE_H_
1818
#define FIRESTORE_CORE_SRC_LOCAL_MEMORY_MUTATION_QUEUE_H_
1919

20+
#include <deque>
2021
#include <set>
2122
#include <vector>
2223

@@ -59,7 +60,7 @@ class MemoryMutationQueue : public MutationQueue {
5960
void RemoveMutationBatch(const model::MutationBatch& batch) override;
6061

6162
std::vector<model::MutationBatch> AllMutationBatches() override {
62-
return queue_;
63+
return std::vector<model::MutationBatch>(queue_.begin(), queue_.end());
6364
}
6465

6566
std::vector<model::MutationBatch> AllMutationBatchesAffectingDocumentKeys(
@@ -128,7 +129,7 @@ class MemoryMutationQueue : public MutationQueue {
128129
* Once the held write acknowledgements become visible they are removed from
129130
* the head of the queue along with any tombstones that follow.
130131
*/
131-
std::vector<model::MutationBatch> queue_;
132+
std::deque<model::MutationBatch> queue_;
132133

133134
/**
134135
* The next value to use when assigning sequential IDs to each mutation

0 commit comments

Comments
 (0)