epeli/underscore.string — pull request #150 by lfac-pt (2012-10-10 10:32:13+00:00)
Title: Implement count without split

split creates an array that is (in this case) immediately thrown away.
This produces unnecessary garbage and its (arguably) faster (see indexOf 1.2):
http://jsperf.com/count-string-occurrence-in-string/10

The downside is that substr can no longer be a RegExp, but this was not
intended (at least according with the docs).
Also in the included test suite the new version is a bit slower than the previous one (about 30%)
but in that case only one string is tested and its very small.