replace() or substr() (v4)

Revision 4 of this benchmark created on


Setup

var str = "<span class=\"ADR\">Albert I<span class=\"SUP\">er</span></span> de Belgique.";
    var regEx = /<[^>]*>/;

Test runner

Ready to run.

Testing in
TestOps/sec
mini split
str = str.split("\<")[0].charAt(0);
ready
split
str = str.split("\<")[0].charAt(0);
ready
precompiled replace
str = str.replace(regEx, '').charAt(0);
ready

Revisions

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