0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-28 19:58:53 +02:00

ircd::db: Bypass row iterator creation when not seeking on construction.

This commit is contained in:
Jason Volk 2019-01-17 15:33:20 -08:00
parent 42d9f6dc79
commit bb354c5c05

View file

@ -9349,6 +9349,7 @@ ircd::db::row::row(database &d,
});
std::vector<Iterator *> iterators;
if(key)
{
// The goal here is to optimize away the heap allocation incurred by
// having to pass RocksDB the specific std::vector type which doesn't
@ -9377,8 +9378,15 @@ ircd::db::row::row(database &d,
for(size_t i(0); i < this->size() && i < column_count; ++i)
{
std::unique_ptr<Iterator> it(iterators.at(i));
(*this)[i] = cell { *colptr[i], std::move(it), opts };
std::unique_ptr<Iterator> it
{
!iterators.empty()? iterators.at(i) : nullptr
};
(*this)[i] = cell
{
*colptr[i], std::move(it), opts
};
}
if(key)