drawImage from different sources
JavaScript performance comparison
Info
Testing rendering performance when using drawImage with different sources (IMG vs offscreen CANVAS)
Preparation code
<canvas id="cnv" width="320" height="240">
</canvas>
<img id="img" src="http://mozilla.org/media/img/firefox/template/header-logo-inverse.png" style="display: none" />
<script>
Benchmark.prototype.setup = function() {
function createCanvas(w, h) {
var canvas = document.createElement('canvas');
canvas.setAttribute('width', w);
canvas.setAttribute('height', h);
return canvas;
}
// globals
var g_ctx = document.getElementById('cnv').getContext('2d');
var g_img = document.getElementById('img');
var g_offscreenCanvas = createCanvas(320, 240);
g_offscreenCanvas.getContext('2d').drawImage(g_img, 0, 0);
};
</script>
Preparation code output
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
img |
|
pending… |
not-in-dom canvas |
|
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 1: published by alekop
- Revision 2: published
- Revision 3: published
- Revision 4: published by alekop
- Revision 5: published by alekop
- Revision 6: published by Kashey
- Revision 7: published
- Revision 8: published by Kashey
- Revision 9: published
- Revision 11: published by Witali
- Revision 12: published by Jonathan
- Revision 14: published by Ben
- Revision 15: published by Ben
- Revision 16: published
- Revision 18: published
- Revision 19: published

0 comments