Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36
Chrome 92
Mac OS X 10.15.7
Desktop
3 years ago
Test name Executions per second
Trust existing 9.9 Ops/sec
Trust new 10.2 Ops/sec
Script Preparation code:
AخA
 
function Vnode(tag, key, attrs0, children0, text, dom) {
    return {tag: tag, key: key, attrs: attrs0, children: children0, text: text, dom: dom, domSize: undefined, state: undefined, events: undefined, instance: undefined}
}
Tests:
  • Trust existing

    x
     
    function trust( html ) {
      if( html == null ) html = "";
      return Vnode("<", undefined, undefined, html, undefined, undefined)
    }
    for( var i = 0; i < 100000; i++) {
      if( i < 50000 ) trust( null );
      else trust( 'test' );
    }
  • Trust new

     
    function trust( html ) {
      return Vnode("<", undefined, undefined, html || "", undefined, undefined)
    }
    for( var i = 0; i < 100000; i++) {
      if( i < 50000 ) trust( null );
      else trust( 'test' );
    }