Уровень 0 · материалов: 3
В кластер входят документы, описывающие техническое устройство, ограничения и неточность таймеров в JavaScript в контексте работы однопоточного цикла событий.
Общие признаки: JavaScript таймеры, цикл событий (event loop), точность выполнения, API окружения
Группа выше: Асинхронность в JavaScript
Смысл: The main idea is to explain that JavaScript timers are environment-provided APIs rather than language features, and to demonstrate their practical application and limitations within the event loop.
An educational guide explaining the implementation, usage, and pitfalls of JavaScript timers (`setTimeout`, `setInterval`) in Node.js and browsers, supplemented with coding exercises.
Смысл: The main idea is that JavaScript timers are not precise because they operate in a single-threaded event loop, meaning they only execute when the main thread is idle, regardless of the specified delay.
JavaScript timers are asynchronous and managed via an event queue in a single-threaded environment, meaning their actual execution time can be delayed by other running code.
Смысл: The main idea is that performance benchmarks can be fundamentally misleading if they rely on unreliable APIs like `setInterval`. The author argues that true benchmarking requires understanding the underlying browser architecture to ensure the test measures the intended feature rather than incidental implementation details.
A critique of a flawed HTML5 Canvas benchmark that explains how browser timer limitations can create fake performance results and suggests using `window.postMessage` for more accurate high-frequency testing.