Static Variable Vs jquery Obj Property

Benchmark created by mbutubuntu on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

<script>
  height = $(document).height();
  
  function static(){
  for(i = 0; i<1000; i++){
  return height;
  }
  }
  
  function objProp(){
  for(i = 0; i<1000; i++){
  return $(document).height();
  }
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Static
static();
ready
Obj Prop
objProp();
ready

Revisions

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

  • Revision 1: published by mbutubuntu on