Clone an img, set .src (v3)

Revision 3 of this benchmark created by RobbertAtWork on


Preparation HTML

<script>
  var templateImg = document.createElement('img');
  templateImg.src = 'http://google.com/favicon.ico';
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
cloneNode(false)
var img = templateImg.cloneNode(false);
img.src = 'http://google.com/favicon.ico';
ready
createElement
var img = document.createElement('img');
img.src = 'http://google.com/favicon.ico';
ready
new Image
var img = new Image;
img.src = 'http://google.com/favicon.ico';
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.

  • Revision 3: published by RobbertAtWork on