Count the number of occurrences in string (v4)

Revision 4 of this benchmark created on


Description

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

Setup

window.m = /2/g;

Test runner

Ready to run.

Testing in
TestOps/sec
regular expression
"124682895579215".match(window.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.