wrf123

JavaScript performance comparison

Test case created

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var name = "One.Two.Three. HOME TOWNE HOBBYIST PIZZA SHOP";
};
</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
wrapped
function wrapper(str) {
  function titleize(s) {
    if (!s) return '';
    var str = s.toLowerCase();
    return str.replace(/(?:^|\s|-|\.|,)\S/g, function(c) {
      return c.toUpperCase();
    });
  };

  return titleize(str);
}

wrapper(name);
pending…
unwrapped
function titleize(s) {
  if (!s) return '';
  var str = s.toLowerCase();
  return str.replace(/(?:^|\s|-|\.|,)\S/g, function(c) {
    return c.toUpperCase();
  });
};

titleize(name);
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