Surma's persistent advocacy for Web Workers as a solution for enhancing website performance deserves recognition. His latest analysis underscores the widespread adoption of multithreading across various platforms:
[…] Multithreading is ubiquitous. iOS leverages Grand Central Dispatch, Android utilizes its unified task scheduler (WorkManager), and game engines like Unity employ job systems. The consistent goal across these platforms is to optimize app responsiveness and user experience.
Surma, “The State Of Web Workers In 2021”
While multithreading is prevalent, web development requires employing Web Workers to overcome JavaScript's inherent single-threaded nature. These workers enjoy broad support. The key challenges lie in how and when to utilize them effectively. Surma illustrates a game example where the entire application state and game logic reside within a worker. The comlink library simplifies this process significantly.
Ideally, popular development tools should seamlessly integrate Web Worker functionality. Current developer outreach efforts seem insufficient. Imagine if frameworks like Apollo, which manage substantial application state, automatically offloaded this processing to a separate thread. This approach seems both logical and potentially achievable.
The above is the detailed content of The State Of Web Workers In 2021. For more information, please follow other related articles on the PHP Chinese website!