el.getAttribute("id") vs el.id (v8)

Revision 8 of this benchmark created by jd on


Description

Testing element.getAttribute("id") vs element.id

Preparation HTML

<input type="text" id="testID" LineNumber="22"                              </input>

<script>
  var element = document.getElementById("testID");
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
.getAttribute("id")
var id = element.getAttribute("lineNumber");
document.write(id);
ready
.id
var id = element.lineNumber;
document.write(id);
ready

Revisions

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