Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36
Chrome 53
Linux
Other
8 years ago
Test name Executions per second
Creation with src 5701.6 Ops/sec
Creation without src 454145.8 Ops/sec
Clone with src 6119.9 Ops/sec
Clone without src 493107.5 Ops/sec
Script Preparation code:
x
 
function makeImage( src ) {
  var img = document.createElement( 'img' );
  img.className='nail';
  if ( src ) {
    img.src='data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=';
  }
  return img;
}
withSrc = makeImage( true );
withoutSrc = makeImage( false );
Tests:
  • Creation with src

     
    makeImage( true );
  • Creation without src

     
    makeImage( false );
  • Clone with src

     
    withSrc.cloneNode();
  • Clone without src

     
    withoutSrc.cloneNode();