I would say the results are shocking but they aligned with my hypothesis. Flash outperforms HTML5 for simple animation used at the core of nearly every game on the internet. The basic principal of games is that the screen is refreshed on an interval x number of times per second as one or many objects move.

This is really a comparison of ActionScript vs JavaScript. They are the development languages behind Flash and HTML5. Both of them are based off of the same core ECMAScript. They both have a similar number of security vulnerabilities JavaScript (1,590) vs Flash (1,110). Both of these technologies SHOULD perform the same.

Problem:
My fan would kick into high gear every time I played a game made with the new canvas component in HTML5. Convinced the crazy fan and high CPU were due to poor development practices I decided to run a simple test. Bounce a black ball up and down at 60 FPS. The concepts used in this demo are the same at the core of almost every game. Don’t take my word for it. Open up your task manager and visit the following links:

HTML5 (JavaScript):
http://www.blackcj.com/blog/wp-content/jsdemos/BallBounce/

Flash (ActionScript):
http://www.blackcj.com/blog/wp-content/swfs/BallBounce/

Want to check out the Flash source but don’t want to pay for Adobe products? Luckily Flash Develop is available for free! So is the SDK!

Results:
These results are from my PC. I would love to see results from a MAC! Any takers? Feel free to post them in the comments section.

HTML5 (JavaScript):

Firefox – 18% CPU
Chrome – 18% CPU
IE – Doesn’t work

Flash (ActionScript):

Firefox – 3% CPU
Chrome – 3% CPU
IE – 0% CPU – This was the most surprising result

Conclusion:
If your going to build a game or do simple animation, use Objective-C or Flash. JavaScript is definitely a useful language that I wouldn’t want to go without but it needs significant help in the performance arena. I would not suggest dropping a lot of money into development for animations or games with canvas at this point. You’ll quickly find users complaining about battery life and CPU usage.

Links:
Flash Player: CPU Hog or Hot Tamale? It Depends.
“HTML5″ versus Flash: Animation Benchmarking
Flash ActionScript performance vs JavaScript (Even in 2006 ActionScript performed better than JavaScript)

*HTML5 won’t officially launch until 2012 (or later) and performance might be improved by then. I haven’t seen any information either way on performance but it’s important to point out that the HTML5 specification is still in DRAFT.