in reply to Question about speeding a regexp count
Alternatively, you could unpack the string and simply iterate through it. A bit more code, but perhaps fast enough.