getters/setters vs direct

Benchmark created by meshokmuki on


Preparation HTML

<script>
 a = {
  a: 1,
  get aa() {
   return this.a;
  },
  set aa(a) {
   this.a = a;
  },
  getA: function() {
   return this.a;
  },
  setA: function(a) {
   this.a = a;
  }
 }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
direct get
a.a
ready
direct set
a.a = 10
ready
getter
a.aa
ready
setter
a.aa = 10
ready
getA
a.getA()
ready
setA
a.setA(10)
ready

Revisions

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

  • Revision 1: published by meshokmuki on