jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase .
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2 Can be accessed at:
https://jsperf.app/negative-modulo/2 prototype vs closures (v77) Revision 77 of this benchmark created by Siva Mamidi on December 10, 2014 Preparation HTML <script src ="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.7.0/underscore-min.js" > </script >
Setup function Person (name ) {
this .name = name;
}
Person .prototype .get_name = function ( ) {
return this .name ;
};
Person .prototype .set_name = function (name ) {
this .name = name;
};
Person .prototype .set_name1 = function (name ) {
this .name = name;
};
Person .prototype .set_name2 = function (name ) {
this .name = name;
};
Person .prototype .set_name3 = function (name ) {
this .name = name;
};
Person .prototype .set_name4 = function (name ) {
this .name = name;
};
Person .prototype .set_name5 = function (name ) {
this .name = name;
};
var person = function (name ) {
var p = {
name : name
};
return {
'get_name' : function ( ) {
return p.name ;
},
'set_name' : function (name ) {
p.name = name;
},
'set_name1' : function (name ) {
p.name = name;
},
'set_name2' : function (name ) {
p.name = name;
},
'set_name3' : function (name ) {
p.name = name;
},
'set_name4' : function (name ) {
p.name = name;
},
'set_name5' : function (name ) {
p.name = name;
}
};
};
var _p = new Person ('John' );
var _c = person ('John' );
Test runner Ready to run.
Run Quick Run Testing in Test Ops/sec Closure read _c.get_name ();
ready
Prototype write _p.set_name ('Jane' );
ready
Closure write _c.set_name ('Jane' );
ready
Prototype init var p = new Person ('John' );
ready
Closure init var c = person ('John' );
ready
Prototype read _p.get_name ();
ready
Revisions You can edit these tests or add more tests to this page by appending /edit to the URL.
Revision 1 : published by proudlygeek on June 6, 2011 Revision 2 : published on August 10, 2011 Revision 3 : published on September 27, 2011 Revision 4 : published on September 27, 2011 Revision 5 : published on September 27, 2011 Revision 6 : published on September 27, 2011 Revision 9 : published on September 27, 2011 Revision 10 : published on September 27, 2011 Revision 11 : published by Simone Deponti on September 27, 2011 Revision 12 : published on September 27, 2011 Revision 13 : published on September 27, 2011 Revision 14 : published on September 28, 2011 Revision 16 : published on September 28, 2011 Revision 17 : published on September 29, 2011 Revision 18 : published by Grant on October 3, 2011 Revision 19 : published by Lorenzo on October 5, 2011 Revision 20 : published by Stephen Reay on April 9, 2012 Revision 21 : published on July 14, 2012 Revision 22 : published on August 30, 2012 Revision 23 : published by Ben Plum on September 20, 2012 Revision 24 : published on February 28, 2013 Revision 25 : published by Oz Elentok on April 21, 2013 Revision 27 : published on May 12, 2013 Revision 30 : published on May 25, 2013 Revision 31 : published on May 26, 2013 Revision 32 : published on May 29, 2013 Revision 33 : published on May 30, 2013 Revision 34 : published on June 15, 2013 Revision 36 : published on July 9, 2013 Revision 37 : published on July 10, 2013 Revision 38 : published by David Bonnet on August 27, 2013 Revision 39 : published by David Bonnet on August 27, 2013 Revision 40 : published by David on August 27, 2013 Revision 42 : published on October 17, 2013 Revision 43 : published by nomiadcode on October 21, 2013 Revision 44 : published on November 26, 2013 Revision 45 : published on November 26, 2013 Revision 47 : published by joujiahe on January 22, 2014 Revision 48 : published on January 29, 2014 Revision 49 : published on January 30, 2014 Revision 50 : published by Wong Lok on February 4, 2014 Revision 51 : published on February 11, 2014 Revision 52 : published on April 17, 2014 Revision 54 : published by Dillon Uzar on April 21, 2014 Revision 56 : published by Peter Lisovin on April 30, 2014 Revision 57 : published by Rcmaniac25 on May 1, 2014 Revision 58 : published by Rich on May 26, 2014 Revision 60 : published on June 2, 2014 Revision 62 : published on July 11, 2014 Revision 63 : published on July 22, 2014 Revision 64 : published on July 30, 2014 Revision 65 : published on August 7, 2014 Revision 67 : published by eight on August 18, 2014 Revision 68 : published on August 22, 2014 Revision 69 : published on September 25, 2014 Revision 70 : published on September 30, 2014 Revision 71 : published on October 4, 2014 Revision 73 : published on October 30, 2014 Revision 74 : published on November 1, 2014 Revision 75 : published on November 25, 2014 Revision 76 : published by Anonymous on December 3, 2014 Revision 77 : published by Siva Mamidi on December 10, 2014 Revision 79 : published by JH on January 21, 2015 Revision 80 : published by a on February 15, 2015 Revision 82 : published by ys on March 21, 2015 Revision 83 : published on March 23, 2015 Revision 84 : published by Doug Gale on March 25, 2015 Revision 85 : published on April 6, 2015 Revision 86 : published by tav on April 28, 2015 Revision 88 : published by ynon on May 27, 2015 Revision 90 : published on June 3, 2015 Revision 91 : published on June 11, 2015 Revision 92 : published on June 12, 2015 Revision 93 : published on August 13, 2015 Revision 94 : published on August 18, 2015 Revision 95 : published on August 26, 2015 Revision 96 : published by Maxi S. on August 30, 2015 Revision 97 : published by JamesAlias on September 2, 2015 Revision 100 : published on September 23, 2015 Revision 101 : published on September 23, 2015 Revision 102 : published on September 23, 2015 Revision 103 : published on September 23, 2015 Revision 104 : published on September 23, 2015