LibWeb: Heap-allocate SerializationRecord in IndexedDB ObjectStoreRecord

Wrap the SerializationRecord (Vector<u8, 1024>) in an OwnPtr so that
each ObjectStoreRecord is only ~16 bytes instead of ~1040+ bytes.
This makes Vector operations on the records list dramatically cheaper
since memmove now shifts pointers instead of kilobyte-sized buffers.
This commit is contained in:
Andreas Kling
2026-03-20 23:35:29 -05:00
committed by Andreas Kling
parent ea5c543322
commit 6564eff91c
Notes: github-actions[bot] 2026-03-21 13:42:23 +00:00
6 changed files with 40 additions and 26 deletions

View File

@@ -60,17 +60,17 @@ bool Index::has_record_with_key(GC::Ref<Key> key)
}
// https://w3c.github.io/IndexedDB/#index-referenced-value
HTML::SerializationRecord Index::referenced_value(IndexRecord const& index_record) const
HTML::SerializationRecord const& Index::referenced_value(IndexRecord const& index_record) const
{
// Records in an index are said to have a referenced value.
// This is the value of the record in the indexs referenced object store which has a key equal to the indexs records value.
return m_object_store
->records()
.first_matching([&](auto const& store_record) {
return Key::equals(store_record.key, index_record.value);
})
.value()
.value;
return *m_object_store
->records()
.first_matching([&](auto const& store_record) {
return Key::equals(store_record.key, index_record.value);
})
.value()
.value;
}
void Index::clear_records()