Showing posts with label jsPerf. Show all posts
Showing posts with label jsPerf. Show all posts

Sunday, January 5, 2014

jsPerf tests for split join replace

Today I have found this code in connect middleware: exports.normalizeSlashes = function normalizeSlashes(path) { return path.split(sep).join('/'); }; So I have immediately jumped to jsPerf and wanted to compare this to alternative methods (for speed). Unlucky as always, I have run into several nonsense tests:
  • http://jsperf.com/split-join-vs-replace-47 - Both revisions 1,2 are wrong not comparing the same things
  • http://jsperf.com/regexp-vs-split-join2 - another treasure
and we could you with the list. Again and again, broken tests and misleading measurements. Please all of you who run into this article, and write or use jsPerf results please read using-jsperf-correctly.

BTW: there is enough room for fiddling elsewhere. On of the tips: "http://jsfiddle.net"

Of course split/join is much slower then intuitive replace. At least with browsers and JSPerf

Update 2013-01-06:

Irony: I have authored BUGGY TEST AS WELL: http://jsperf.com/normalizeslashes-split-join-vs-replace and I hope fixed version 2 is better ;-) http://jsperf.com/normalizeslashes-split-join-vs-replace/2

Tuesday, March 5, 2013

dojox/mobile/parser (jsPerf test needed from androids)

Few notes on the code in mobile parser, still waiting for feedback: http://bugs.dojotoolkit.org/ticket/16795 Please, click the tests on jsPerf: