4 ms·
Just to explain core.async uses the fastest dispatching mechanism available, Firefox doesn't provide anything sensible like MessageChannel so we just resort to
by swannodette 13y ago
Just to explain core.async uses the fastest dispatching mechanism available, Firefox doesn't provide anything sensible like MessageChannel so we just resort to setTimeout. setTimeout in all major browsers has a 5ms delay between nested calls - thus all the discussion about setImmediate the past 2 years or so.
I am surprised about IE 10 since we do use setImmediate if available, but I haven't done much testing there - will need to look into it.
- vmarsy 13y agoThanks for the explanation. On your machine what time does it take to color all the numbers on : IE10, Firefox and Chrome ?
- swannodette 13y agoFF probably takes about the same time - Chrome takes only a 5-6 seconds. I don't have IE 10 handy.
- bzbarsky 13y agoFF takes longer just because the script is pretty broken, imo: it only processes 4-5 chars per 16ms frame, and reflowing/painting each frame tick here is the expensive thing in all browsers. As a result, the behavior of the script in wall-clock time is O(N^2/K) where N is the number of chars and K is the number it processes in a single tick. Furthermore, its CPU consumption is pretty much constant no matter what K is for a wide range of K.
- kevingadd 13y agoWhy can't you use postMessage? I use it for low-latency callbacks ala setImmediate and it works fine.
- cpeterso 13y agoCan you use window.postMessage() on Firefox? Barnes & Noble's (?!) NobleJS library has a setImmediate() polyfill, which uses postMessage() on Firefox: https://github.com/NobleJS/setImmediate/blob/master/setImmediate.js#L202 https://github.com/NobleJS/setImmediate/blob/master/setImmed...
- swannodette 13y agoWe could use postMessage but it's rather frustrating since that's a global post and we have detect our own messages on the other side. So until Firefox supports MessageChannel we're unlikely to go that route.
- bzbarsky 13y agoWhat do you use on Chrome? What I see is that the page is using self-throttling to a ridiculous extent in Firefox, but not Chrome, with way too few letters changed between paints. Are you doing a single letter from each async callback or something?