LibWeb: Avoid expensive Vector filtering in event loop

Instead of collecting all documents in a big vector and then filtering
the vector (twice!) with remove_all_matching(), we now pass a filter
callback to documents_in_this_event_loop_matching() and avoid all the
extra shuffling work.

Saw this stuff hogging ~20% of CPU time when profiling a WebContent
process in the middle of a WPT run.
This commit is contained in:
Andreas Kling 2024-11-24 15:47:18 +01:00 committed by Andreas Kling
commit 26f32b11f9
Notes: github-actions[bot] 2024-11-24 16:18:45 +00:00
2 changed files with 23 additions and 17 deletions

View file

@ -95,6 +95,8 @@ private:
virtual void visit_edges(Visitor&) override;
[[nodiscard]] Vector<GC::Root<DOM::Document>> documents_in_this_event_loop_matching(auto callback) const;
void update_the_rendering();
Type m_type { Type::Window };