html5 double layer canvas vs on layer canvas
JavaScript performance comparison
Info
Test des performances d'affichage de canvas html5.
En mode double layer : un premier canvas affiche une image de fond et un second canvas (affiché au dessus du premier) s'efface puis affiche une petite image.
En mode one layer : un seul canvas s'efface, puis affiche une image de fond et enfin une petite image.
Preparation code
<div style="position: relative; width: 400px; height: 400px">
<canvas id="background" width="400" height="400" style="position:absolute;z-index:0;border: 1px solid #000000;">
</canvas>
<canvas id="foreground" width="400" height="400" style="position:absolute;z-index:1;border: 1px solid #000000;">
</canvas>
</div>
<script>
var bgCtx= document.querySelector('#background').getContext('2d');
var fgCtx= document.querySelector('#foreground').getContext('2d');
var imgBg = new Image();
imgBg.src = 'http://www.faire-des-jeux.com/jsperf/background.jpg';
var imgFg = new Image();
imgFg.src = 'http://www.faire-des-jeux.com/jsperf/module.png';
</script>
Preparation code output
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
one layer canvas |
|
pending… |
double layer canvas |
|
pending… |
double layer only one clear |
|
pending… |
Compare results of other browsers
Revisions
You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:
- Revision 3: published by Franck Dubois
- Revision 4: published by Spirin Vladimir
- Revision 5: published by PlaneWorld
- Revision 6: published
- Revision 9: published by HotSix
0 comments