Count the number of occurrences in string (v3)

Revision 3 of this benchmark created on


Description

check the number of occurrences of a single number in a string of numbers

Setup

var m = /2/g;

Test runner

Ready to run.

Testing in
TestOps/sec
regular expression
"124682895579215".match(m).length;
ready
split
"124682895579215".split("2").length - 1
ready

Revisions

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