Monday, August 23, 2010

Performance Notes

This morning I decided to add back the DOM rendering context into the "bounce the ball" demo.  How it got removed, I'm not sure, but it's back now in trunk.  You simply enable it by appending "context=dom" in the URL -- by default, it uses the canvas context.  After doing this, and relating to a blog post I read last night, I decided to get some performance numbers using this demo.  Now, realize that this is still very early in v2.0 development and their will be time to optimize, but I wanted to see where some browsers were at regarding engine performance.  The test was simple and not super scientific, but I ran the demo at 30fps (33ms available frame time) and added bouncing balls until the metrics topped out at an engine load of ~100%.  Below are the quick results:

Chrome 6.0.472.41
-----------------
DOM Context - 32 balls
Canvas      - 66

Firefox 3.6.8
-----------------
DOM Context - 17 balls
Canvas      - 17

Firefox 4.0b3
-----------------
DOM Context - 17 balls
Canvas      - 21

Computer specs:
Windows XPsp3
Intel Core2 Quad CPU (Q9300 @ 2.50GHz)
4GB

While this doesn't really tell much, it does show that Chrome's canvas rendering is pretty amazing.  66 physically animated balls bouncing around is pretty intense.  Especially considering that the best Firefox could muster was 21.  Like I said, not very scientific but still interesting none the less.  This points to the fact that The Render Engine's scene graph needs to be optimized a bit.

Understand that the physics demo really puts a strain on any computer.  While it performs quite well, considering how much it does, it's still performing a ton of calculations each and every frame.  It's currently set at 10 integrations per frame to calculate collisions, so I could lower that in favor of more speed for less accuracy.  There is a lot of tuning that could be done to eek out as much performance as possible, but it's still going to really test the capabilities of the engine.

Once all of the features are in the engine for v2.0, I plan on spending some time optimizing The Render Engine for each platform it supports (within reason, of course) to get the most performance out of it.  Some things will be major wins for all platforms, while others will be specific tweaks per browser.  By far, Chrome is still the best when it comes to performance.  I'm still amazed at how much horsepower the V8 engine can put out.

No comments:

Post a Comment