javascript benchmarking with jsperf

I might be a bit late (yeaikno it exist over a year now and a bunch of blogs had it covered) but nevertheless i would like to point out a very helpful online tool i recently ran into:

jsPerf

Its basically a online benchmark tool for testing different approaches in javascript.
It covers some important aspects of benchmarking, that your homemade bench probably wont have like milliseconds accuracy & statistical analysis.
The tests are run on your browser and the results will feed the “browserscope”. A graph of the “highest known results” for the participating browsers.
So we can see some kind of comparison.

Almost all classic concurrent approaches are covered, my favorites are:

String concatenation

JavaScript Template Engines, in this revision its: juicer, mustache, ejohn, kissy, nTenjin
( yes it has revisions :) )

switchClass OR removeClass and addClass

fastest jQuery selectors to remove class

See if you can find some, you struggled with lately:
http://jsperf.com/browse

JsPerf has some further interesting options like
autorun
append #run to the URL of the test case

filters for the browserscope
filters are: popular, all, desktop, family, major, minor, mobile, prerelease

chart types of browserscope
append #chart=table to the test case’s URL
types are: bar(default), table, column, line, and pie

Give it a try, daily!

Leave a Reply

Your email address will not be published. Required fields are marked *