slice vs match (v2)

Revision 2 of this benchmark created by krwck on


Setup

var stringy = Function.prototype.call.bind(Object.prototype.toString);

Test runner

Ready to run.

Testing in
TestOps/sec
slice
Object.prototype.toString.call([]).slice(8, -1);
ready
match
Object.prototype.toString.call([]).match(/^\[object\s(.*)\]$/i)[1];
ready
instanceof
[] instanceof Array;
ready
pure call
stringy([])
ready

Revisions

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

  • Revision 2: published by krwck on