imafeature / jsonpath

Automatically exported from code.google.com/p/jsonpath
0 stars 0 forks source link

Improve performance by avoiding closures (js-version) #17

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
You should avoid closures inside of the jsonPath()-function in the js-version 
in order to improve performance.

Example:

(function() {
   function doSomething() {};
   function jsonPath() {
      doSomething();
   };
})();

is faster than

function jsonPath() {
   function doSomething() {};
   doSomething();
}

because those functions have to be created by the js-interpreter on every call 
to jsonPath.

Original issue reported on code.google.com by Uli.He...@googlemail.com on 31 Oct 2010 at 3:40