News for hackers. Stuff that matters.
Re:Main-Thread-Scheduling by rictic on Friday January 05, 2024 @12:41PM (#38881970)
Have you benchmarked the overhead of awaiting? I believe that in doing so you yield to the microtask queue and then your function has to be scheduled and run again. You could compare

        await yieldOrContinue('user-visible');
        doSomeWork();
against

        if (isTimeToYield('user-visible')) {
            await yieldControl('user-visible');
        }
        doSomeWork();
A few years back when I measured it on a fast laptop the cost was ~1µs to do `await 0;`
Re:Main-Thread-Scheduling by astoilkov on Monday January 08, 2024 @04:23AM (#38909779)
I haven't. I should do that. Many people are talking about this and this makes me think I should measure and talk about it in the readme. Thanks!