Re:Make Your UI More Responsive with HTML5 Web Workers
by jdwissler on Sunday April 21, 2013 @04:28PM
(#5586282)
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.
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.
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.
However, maybe I just don't understand how Web Workers work.
Re:Make Your UI More Responsive with HTML5 Web Workers
by robmil on Sunday April 21, 2013 @11:52AM
(#5585214)
I realise this is snark about the article going down, but it's actually a good point too. Not much point in optimising the client side if all your dynamic requests take a second for the server to process.
Re:Make Your UI More Responsive with HTML5 Web Workers
by mtrimpe on Sunday April 21, 2013 @11:59AM
(#5585236)
Good point. I once spent three months developing a highly optimized dynamically loading Google Maps point & line overlay library capable of smoothly scrolling through thousands of elements with hundreds on screen on 10 year old single-core Pentiums.
In the end the server team ended up implementing a home-grown geo-search on an XML document store with an average query time of several seconds.
Re:Make Your UI More Responsive with HTML5 Web Workers
by robmil on Sunday April 21, 2013 @09:14AM
(#5584733)
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".
Re:Make Your UI More Responsive with HTML5 Web Workers
by Alphasite_ on Sunday April 21, 2013 @09:30AM
(#5584766)
I think this is the case for nearly every technology, new, or old, and although they wouldn't be amiss to mention it, 60% is a lot better than a lot of other techniques which get mentioned here.
Re:Make Your UI More Responsive with HTML5 Web Workers
by robmil on Sunday April 21, 2013 @11:51AM
(#5585206)
Oh, absolutely. Web workers are awesome and hopefully the future, but it seems a bit disingenuous not to mention the huge caveat that currently prevents their being adopted in a more widespread way.
Re:Make Your UI More Responsive with HTML5 Web Workers
by polshaw on Sunday April 21, 2013 @11:50AM
(#5585203)
Sadly, can't even use it for cross-platform packaged apps (min requirement: chromium, iOS browser, android browser) because the android removed support after 2.1.
Re:Make Your UI More Responsive with HTML5 Web Workers
by leeoniya on Sunday April 21, 2013 @04:58PM
(#5586386)
pdf.js uses background workers for parsing/processing pdf pages. really any other native format which could potentially js-processed for display in a browser directly
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.
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.
However, maybe I just don't understand how Web Workers work.
In the end the server team ended up implementing a home-grown geo-search on an XML document store with an average query time of several seconds.
But if I was working for a chinese market place, or a bank intranet I'm sure it would be 80% IE6.
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.