_.startsWith

Benchmark created by Graeme Yeates on


Preparation HTML

<script src="//rawgit.com/lodash/lodash/master/lodash.js"></script>
<script>
        var lodash = _.noConflict();
</script>
<script src="//rawgit.com/epeli/underscore.string/master/lib/underscore.string.js"></script>
<script>
        var core = _.str;
</script>
<script src="//rawgit.com/megawac/underscore.string/sends-with/lib/underscore.string.js"></script>
<script>
        var mega = _.str;
</script>

Setup

var string = lodash.range(100).join(",");
    var ends = string.slice(-11);

Test runner

Ready to run.

Testing in
TestOps/sec
lodash.endsWith
var has = lodash.endsWith(string, ends);
var noHas = lodash.endsWith(string, ends, -1);
ready
epeli/master endsWith
var has = core.endsWith(string, ends);
var noHas = core.endsWith(string, ends, -1);
ready
#345/endsWith
var has = mega.endsWith(string, ends);
var noHas = mega.endsWith(string, ends, -1);
ready

Revisions

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

  • Revision 1: published by Graeme Yeates on