starts with

Benchmark created by Karl Seamon on


Setup

var key1 = 'abceddfgrdfgdfg';
    var key2 = '$$345t345t45t';

Test runner

Ready to run.

Testing in
TestOps/sec
angular current
key1.substr(0, 2) !== '$$'
key2.substr(0, 2) !== '$$'
ready
goog.string.startswith
key1.lastIndexOf('$$', 0) === 0;
key2.lastIndexOf('$$', 0) === 0;
ready
another
key1.charAt(0) === '$' && key1.charAt(1) === '$';
key2.charAt(0) === '$' && key2.charAt(1) === '$';
ready
another 2
key1.charCodeAt(0) === 36 && key1.charCodeAt(1) === 36;
key2.charCodeAt(0) === 36 && key2.charCodeAt(1) === 36;
ready

Revisions

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

  • Revision 1: published by Karl Seamon on