globalizer

JavaScript performance comparison

Test case created by Angus

Preparation code

<script>
  var $g = function(fn) {
   var args = arguments;
   return function() {
    return fn.apply(arguments[0], [].slice.call(args, 1).concat([].slice.call(arguments, 1)));
   }
  }
  
  var mailEx = /\b[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}\b/;
  var dataFeed = "Clarence|Green|clarence@mymail.com|12312312";
  var bigArrayOfStrings = [],
      x = 1000;
  while (x--) {
   bigArrayOfStrings.push(" aaaa ");
  }
</script>
    

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
Conventional email finder
dataFeed.split('|').filter(function(each) {
 return each.match(mailEx)
});
pending…
email finder with Globalizer
dataFeed.split('|').filter($g(''.match, mailEx));
pending…
Conventional trim
bigArrayOfStrings.map(function(each) {
 return each.trim();
})
pending…
trim with Globalizer
bigArrayOfStrings.map($g("".trim));
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