test

JavaScript performance comparison

Test case created by Roy

Preparation code

<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.4/underscore-min.js"></script>
<script>
Benchmark.prototype.setup = function() {
    var value = '123,234,45,34, 1231  ,123';
};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
c
_.chain(_.isString(value) ? value.split(/\D+/) : []).filter(function(n){return n}).uniq().value().join(',');
pending…
m
var test2 = value.replace(/[A-Za-z, ]/g, "#");

r  = _.filter(test2.split('#'), function(num){ return num; })

test2 = r.join(',');
pending…

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

Compare results of other browsers

0 comments

Add a comment