mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:37:36 +00:00
LibSQL: Avoid unnecessary copies in Heap
This commit is contained in:
parent
5c4b2e8447
commit
182a85c895
1 changed files with 3 additions and 5 deletions
|
@ -181,12 +181,10 @@ ErrorOr<void> Heap::flush()
|
||||||
}
|
}
|
||||||
quick_sort(blocks);
|
quick_sort(blocks);
|
||||||
for (auto& block : blocks) {
|
for (auto& block : blocks) {
|
||||||
auto buffer_or_empty = m_write_ahead_log.get(block);
|
auto buffer_it = m_write_ahead_log.find(block);
|
||||||
if (buffer_or_empty->is_empty()) {
|
VERIFY(buffer_it != m_write_ahead_log.end());
|
||||||
VERIFY_NOT_REACHED();
|
|
||||||
}
|
|
||||||
dbgln_if(SQL_DEBUG, "Flushing block {} to {}", block, name());
|
dbgln_if(SQL_DEBUG, "Flushing block {} to {}", block, name());
|
||||||
TRY(write_block(block, buffer_or_empty.value()));
|
TRY(write_block(block, buffer_it->value));
|
||||||
}
|
}
|
||||||
m_write_ahead_log.clear();
|
m_write_ahead_log.clear();
|
||||||
dbgln_if(SQL_DEBUG, "WAL flushed. Heap size = {}", size());
|
dbgln_if(SQL_DEBUG, "WAL flushed. Heap size = {}", size());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue