Run details:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0
Firefox 45
Ubuntu
Other
8 years ago
Test name Executions per second
Creation with src 28187.5 Ops/sec
Creation without src 670704.6 Ops/sec
Clone with src 31003.2 Ops/sec
Clone without src 507059.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();