Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:133.0) Gecko/20100101 Firefox/133.0
Firefox 133
Linux
Desktop
3 months ago
Test name Executions per second
createTextNode 2837661.5 Ops/sec
textContent 4143263.8 Ops/sec
innerText 2434765.2 Ops/sec
append 4884658.0 Ops/sec
new text 3667691.8 Ops/sec
Script Preparation code:
AخA
 
var a = document.createElement('a');
Tests:
  • createTextNode

     
    a.appendChild(document.createTextNode('text'));
  • textContent

     
    a.textContent = 'text';
  • innerText

     
    a.innerText = 'text';
  • append

     
    a.append('text');
  • new text

     
    a.appendChild(new Text('text'));