mirror of
https://github.com/RGBCube/serenity
synced 2025-07-02 23:12:08 +00:00
LibWeb: Don't create mutation record node lists if nobody is interested
By deferring allocation of StaticNodeList objects until we know somebody actually wants the MutationRecord, we avoid a *lot* of allocation work. This shaves several seconds off of loading https://tc39.es/ecma262/ At least one other engine (WebKit) skips creating mutation records if nobody is interested, so even if this is observable somehow, we would at least match the behavior of a major engine.
This commit is contained in:
parent
0f2b6345c6
commit
80d6330a26
4 changed files with 22 additions and 31 deletions
|
@ -71,9 +71,7 @@ WebIDL::ExceptionOr<void> CharacterData::replace_data(size_t offset, size_t coun
|
|||
count = length - offset;
|
||||
|
||||
// 4. Queue a mutation record of "characterData" for node with null, null, node’s data, « », « », null, and null.
|
||||
auto added_node_list = TRY(StaticNodeList::create(realm(), {}));
|
||||
auto removed_node_list = TRY(StaticNodeList::create(realm(), {}));
|
||||
queue_mutation_record(MutationType::characterData, {}, {}, m_data, added_node_list, removed_node_list, nullptr, nullptr);
|
||||
queue_mutation_record(MutationType::characterData, {}, {}, m_data, {}, {}, nullptr, nullptr);
|
||||
|
||||
// 5. Insert data into node’s data after offset code units.
|
||||
// 6. Let delete offset be offset + data’s length.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue