Solving productivity problems using asynchronous methods in JavaScript

Authors

  • Oleksandr Zakovorotnyi National Technical University «Kharkiv Polytechnic Institute»
  • Oleskandr Sapalskyi National Technical University «Kharkiv Polytechnic Institute»

DOI:

https://doi.org/10.26906/SUNZ.2025.1.83-86

Keywords:

asynchronous programming, JavaScript, web application performance

Abstract

The subject of study in the article are the performance issues in modern web applications caused by the
single-threaded nature of JavaScript. Specifically, it investigates how blocking operations, like synchronous XMLHttpRequests (XHR), can negatively impact the responsiveness of user interfaces. The study explores how asynchronous programming can improve the user experience by preventing interface lag and optimizing task handling. The task is to explore and
demonstrate how various asynchronous techniques, including callbacks, promises, asyn c/await, and methods such as setTimeout, queueMicrotask, requestAnimationFrame, and requestIdleCallback, can be employed to address performance bottlenecks in a web-based smart home application. Additionally, the use of Web Workers to offload intensive cal culations to
background threads is examined. The following results were obtained: The study shows that transitioning from synchronous XHR to asynchronous methods significantly reduces the occurrence of interface freezing. Callbacks and promises
provide basic improvements in responsiveness, while async/await makes the code more readable and easier to manage.
Methods like setTimeout and requestAnimationFrame allow deferring non-critical tasks, improving performance during
active user interaction. Web Workers were effectively used to handle complex computations, preventing the main thread
from being blocked and allowing the application to remain responsive even during intensive processing. Conclusions: Asynchronous programming techniques are essential for optimizing the performance of JavaScript-based web applications. By
adopting these methods, developers can prevent interface blocking and enhance the overall user experience. The use of Web
Workers for background processing further improves performance, making these approaches highly applicable to complex
applications like smart home systems. Future research could focus on refining these techniques for specific use cases and
exploring additional strategies for performance optimization.

Downloads

References

1. Addy Osmani. A comprehensive iot attacks survey based on a building-blocked reference mode. URL:https://web.dev/articles/long-tasks-devtools?hl=en (дата звернення 20.10.2024).

2. Miller R. B. Response time in man-computer conversational transactions //Proceedings of the December 9-11, 1968, fall joint computer conference, part I. – 1968. – С. 271-277. DOI: https://doi.org/10.1145/1476589.1476628

3. MDN. Window: requestAnimationFrame() method. URL: https://developer.mozilla.org/enUS/docs/Web/API/Window/requestAnimationFrame (дата звернення 20.10.2024). 1. 4 MDN. Window: requestIdleCallback() method. URL: https://developer.mozilla.org/enUS/docs/Web/API/Window/requestIdleCallback (дата звернення 20.10.2024).

4. Jeremy Wagner. Optimize long tasks. URL: https://web.dev/articles/optimize-long-tasks?hl=en (дата звернення 20.10.2024).

Published

2025-03-12