trim native vs polyfills

Benchmark created by Roderick on


Setup

var strings = ' foo ofoof oofoofo ooofooofoo ofoofoofo foas eaoce o ';
    
    var STRING_REGEX = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
    var trimStringsFunction = function (str) {
        return str.replace(STRING_REGEX, '');
    };

Test runner

Ready to run.

Testing in
TestOps/sec
javascript native trim
strings.trim();
ready
polyfills
trimStringsFunction(strings);
ready

Revisions

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

  • Revision 1: published by Roderick on