100,000 DOM Updates
swannodette.github.io
swannodette.github.io
How does it get so fast even without setImmediate? Does it use the postMessage or MutationObserver tricks?
(defn ex0-key-events [prevent-default?]
(->> (events js/window "keydown" prevent-default?)
(map key-event->keycode)
(filter KEYS)
(map key->keyword)))
Where did the `events` function (line 2) come from? Does it create a lazy dechunked seq which takes events from a buffered channel? Is it built atop RxJS?(Sorry, I haven't yet used ClojureScript, only Clojure. Googling didn't help.)
(defn events [object type]
(let [out (chan)]
(.addEventListener object type (fn [e] (put! out e)))
out))Everyone is welcome to contribute.
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.
https://github.com/NobleJS/setImmediate/blob/master/setImmed...
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?
way way way faster on chrome than on either nightly/firefox
The test needs to be changed to try postMessage on Firefox and any other browser version lacking MessageChannel, or else it should just fail with an alert -- "waiting for Firefox to implement MessageChannel" -- because what it's doing on Firefox is an irrelevant timekiller, as bz showed a few comments above at https://news.ycombinator.com/item?id=6154170.