Test name | Executions per second |
---|---|
character index | 3290673.0 Ops/sec |
charAt() | 2496794.2 Ops/sec |
slice() | 1082196.8 Ops/sec |
var str = 'foo bar baz';
var noop = Function.prototype;
if (str[0] == 'f') noop();
if (str.charAt(0) == 'f') noop();
if (str.slice(0, 1) == 'f') noop();