specialSetAttribute

JavaScript performance comparison

Test case created by Igor Minar and last updated

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  var div = document.createElement('div');
  var templateDiv = document.createElement('div');
  var key = 'key';
  var value = '"constant"';
  
  templateDiv.innerHTML = '<div [key]="">';
  var keyAttribute = templateDiv.firstChild.attributes[0];
  var clone = div.cloneNode();

};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
setAttribute
clone.setAttribute('bind-' + key, value);
pending…
clone + setAttribute
var clone = div.cloneNode();
clone.setAttribute('bind-' + key, value);
pending…
specialSetAttribute
var attr = keyAttribute.cloneNode();
attr.value = value;
clone.attributes.setNamedItem(attr);
pending…
clone + specialSetAttribute
var clone = div.cloneNode();
var attr = keyAttribute.cloneNode();
attr.value = value;
clone.attributes.setNamedItem(attr);
pending…

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

Compare results of other browsers

0 Comments