mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 18:17:22 +02:00
The microtask queue is a pure FIFO (enqueue at back, dequeue from front) but was using a Vector, making every dequeue O(n) due to element shifting. Replace it with AK::Queue which has O(1) dequeue. This makes a huge difference when processing large numbers of microtasks, e.g. during async-heavy JavaScript workloads where each `await` generates a microtask. Also add a for_each() method to AK::Queue so the GC can visit the queued tasks.
6.0 KiB
6.0 KiB