Benchmark Tests
Every test is run twice – without a timer to get the plain cpu performance and run with a timer to get “real world” values.
1. Minimum Timer Resolution
ThereĀ is a minimum timer resolution, which limits the usage of the setInterval and setTimeout. The WebKit browser allows a minimum of 4ms but this resolution is currently only achieved on desktop CPUs. The standard value is about 10ms which would allow a framerate of 100 fps.
The Timer Test run without timer gives us the time of the benchmark code overhead – should be very low and nothing to worry about.
2. clearRect
Clears the whole canvas element with ctx.clearRect(). This is not really a real “world example”, since you would normally draw an image background instead of a single coloured background. Well, yes, depends on your application.
3. 8bit Image
Draws a full screen 256 colours (320 x 480, 8bit, png) image without any transparency.
4. 8bit transparent
Draws a full screen 256 colours (320 x 480, 8bit, png) image with one-colour-transparency.
5. 24bit Image
Draws a full screen 16,777,216 colours (320×480,24bit, png) image without any transparency.
6. 24bit Random Image
Draws a full screen 16,777,216 colours (320 x 480, 24bit, png) image without any transparency but with random pixels. This test should last about the same time as the 24bit Image Test and ensures the internal uncompressed storage of the image.
7. 24bit alpha transparency
Draws a full screen 16,777,216 colours (320 x 480, 24bit, png) image with alpha transparency.
8. single frame sprite
Draws a 100 x 100 pixel sprite with alpha transparency, with one single frame.
9. animated sprite
Draws a 100×100 pixel sprite with alpha transparency (set up as a sprite sheet and uses “copyRect” to display the appropriate frame).
10. animated sprite on background
Redraws the complete background (24bit, png) and puts an animated sprite on top (combination of Test 5 and Test 9).
11. 8x animated sprites on background
Redraws the complete background (24bit, png) and puts eight animated sprites on top (combination of Test 5 and 8x Test 9).
