3 ms·
I don't think you can come to any conclusions from these numbers. I see the exact same CPU utilization across browsers if I replicate the styles and write this
by swannodette 13y ago
I don't think you can come to any conclusions from these numbers. I see the exact same CPU utilization across browsers if I replicate the styles and write this JavaScript instead:
var loc = document.getElementById("location");
window.addEventListener("mousemove", function(e) {
loc.innerHTML = e.pageX + ", " + e.pageY;
});
Which is saying something, the ClojureScript is doing a lot more work and it ain't slow ;)
I suspect all the cost is from repainting large areas at the speed of mouse movement. But the mouse examples are for illustration - in production code you'll probably want to throttle (which would avoid piling up the repaints you observed on slower machines) as well as address the IE 10 edge case.
- vanderZwan 13y agoWell, my question was why one browser was slower than the other - I didn't expect ClojureScript to be the cause of the problem. I was just curious about what might cause the difference. > I suspect all the cost is from repainting large areas at the speed of mouse movement. I'm not really a web dev, but isn't this a reflow, not a repaint? Could that be the reason for the difference in performance too? What happens if you use canvas instead of changing a div? BTW, I forgot to mention this in the previous comment, but: this is pretty cool! I echo the "being spoilt by Go" sentiments of others, so I'm happy to see this library.