TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Make Your UI More Responsive with HTML5 Web Workers

42 点作者 johnrobinsn大约 12 年前

4 条评论

jdwissler大约 12 年前
If HTML 5/JS is going to become a serious platform for applications I think it is going to have to be able to leverage multiple threads/cores much more easily. I don't use Web Workers simply because they are too limited in scope in my opinion.<p>Sometimes I just want to search through my local data in my main thread to process 'n' numbers to show some result to the user and I don't want to lock up the DOM for 'n' milliseconds. I also don't want to make an entire new script file just for processing 'n' numbers, what if I need access to data in my main thread? Do I package 'n' numbers up and then send it as JSON? Well that can take more time then actually processing the numbers....and timers...such a hack.<p>I don't know all the design decisions behind web workers and I understand the safety of communicating with strings and events, but sometimes I really just want to call 'new Thread()' and have access to all my variables and data in my main thread. Yes it can be dangerous, yes you can fuck it up, but we still have that problem when we try to make our servers fast.<p>However, maybe I just don't understand how Web Workers work.
addandsubtract大约 12 年前
Step 1. Make your server more responsive.
评论 #5584924 未加载
评论 #5585214 未加载
robmil大约 12 年前
Unfortunately they're not supported in IE9 or below, which this article oddly fails to mention. So a more accurate title might be "make your UI more responsive for ~60% of your users with HTML5 web workers".
评论 #5585300 未加载
评论 #5584766 未加载
评论 #5585203 未加载
评论 #5585808 未加载
评论 #5586468 未加载
评论 #5584760 未加载
dreamdu5t大约 12 年前
What's a practical example of something that can't be done with proper evented programming, and has to be implemented using web workers?<p>If you need to perform CPU heavy calculations or processing of video/audio it just doesn't make sense to do it on the client even with web workers.
评论 #5586386 未加载