[whatwg] Canvas pixel manipulation and performance

Mike Hearn mike at plan99.net
Sun Nov 29 10:58:36 PST 2009

> That's one way to get a healthy performance boost (typically)
> but where does the web developer stand in this work?  Are
> you suggesting native code should replace JavaScript?

For code where performance is critical (like complex animation code) .... yes.

Don't get me wrong, I'm all for better JavaScript performance, but we
have to be realistic. Compared to native code JavaScripts performance
will always be lacking - many clever tricks have been deployed to
speed up JavaScript but even the fastest JS engines don't come close
to the output of average C++ compilers/JVMs. The nature of JS makes it
likely that this situation will remain true for a long time, perhaps

So there are two possibilities here - one is to introduce ever more
complexity into the web APIs for diminishing returns, even though a
primary goal of the web APIs is simplicity. And the other is to just
bind native code to those APIs, hopefully eliminating much of the
marshalling overhead along the way.

The latter approach has the advantage of not requiring novice-level
developers to understand things like endianness or bit masking to draw
some pixels (replace as appropriate for any given API), whilst
allowing developers that need it to get the fastest execution securely

More information about the whatwg mailing list