mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02: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
Notes:
github-actions[bot]
2025-12-27 17:41:20 +00:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/LadybirdBrowser/ladybird/commit/38af5d623c4 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7249
@@ -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