setAttribute vs id property

Benchmark created by Wayde on


Setup

var test = document.createElement('div');

Teardown


    document.body.appendChild(test);
  

Test runner

Ready to run.

Testing in
TestOps/sec
setAttribute
test.setAttribute('id','test-id');
ready
id property
test.id = 'test-id';
ready

Revisions

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