mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-08 16:12:23 +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.
35 KiB
35 KiB