control vs htmlelement

Benchmark created by hue on


Preparation HTML

<div id="data">?</div>

Setup

var Component = (function() {
      function Component(element) {
        this.element = element;
      }
      Object.defineProperty(Component.prototype, "value", {
        get: function() {
          return this._value;
        },
        set: function(value) {
          if (this._value === value) {
            // identical value, do nothing
            return;
          }
    
          this._value = value;
        },
        enumerable: true,
        configurable: true
      });
    
      return Component;
    })();
    
    var element = document.getElementById("data");
    var control = new Control(element);

Test runner

Ready to run.

Testing in
TestOps/sec
1
element.innerHTML = Math.random();
ready
2
control.num(Math.random());
ready

Revisions

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