mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-27 11:55:15 +00:00
mutation_reader: optimize make_reader_returning()
make_reader_returning() is used by the single-key query path, and is slowed down by needlessly allocating a vector, which is initialized by copying the mutation (as initializer_list<> can not be moved from). Fix by giving it its own implementation instead of relying on make_reader_returning_many().
This commit is contained in:
committed by
Tomasz Grabiec
parent
5f62f7a288
commit
16d6daba64
@@ -158,7 +158,14 @@ make_lazy_reader(std::function<mutation_reader ()> make_reader) {
|
||||
}
|
||||
|
||||
mutation_reader make_reader_returning(mutation m) {
|
||||
return make_reader_returning_many({std::move(m)});
|
||||
return [m = std::move(m), done = false] () mutable {
|
||||
if (done) {
|
||||
return make_ready_future<mutation_opt>();
|
||||
} else {
|
||||
done = true;
|
||||
return make_ready_future<mutation_opt>(std::move(m));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
mutation_reader make_reader_returning_many(std::vector<mutation> mutations) {
|
||||
|
||||
Reference in New Issue
Block a user