mirror of
https://github.com/zebrajr/ladybird.git
synced 2026-01-15 12:15:15 +00:00
LibWeb: Avoid shifting vector elements in get_session_history_entries()
This function essentially performs a BFS traversal over document states. With this change, we let `doc_states` grow instead of removing traversed states, avoiding shifting elements on every iteration. This reduces `./test-web -j 1` from ~7m to ~5m on my machine.
This commit is contained in:
committed by
Andreas Kling
parent
207d82f8bc
commit
38af5d623c
@@ -672,8 +672,8 @@ Vector<GC::Ref<SessionHistoryEntry>>& Navigable::get_session_history_entries() c
|
||||
doc_states.append(entry->document_state());
|
||||
|
||||
// 6. For each docState of docStates:
|
||||
while (!doc_states.is_empty()) {
|
||||
auto doc_state = doc_states.take_first();
|
||||
for (size_t i = 0; i < doc_states.size(); ++i) {
|
||||
auto doc_state = doc_states[i];
|
||||
|
||||
// 1. For each nestedHistory of docState's nested histories:
|
||||
for (auto& nested_history : doc_state->nested_histories()) {
|
||||
|
||||
Reference in New Issue
Block a user