laziness, impatience, and hubris | |
PerlMonks |
Re: number of unique characters in a stringby BrowserUk (Patriarch) |
on Mar 01, 2003 at 04:49 UTC ( [id://239650]=note: print w/replies, xml ) | Need Help?? |
Updated To correct error introduced whilst sanitising for public consumption. It would be interesting to see how this would compare with merlyn's Inline::C version for performance. Unfortunately, I still don't have that ability (yet). One point to note, this version should also work for unicode strings. If you don't need that, then swapping the unpack template from 'U*' to 'C*' should do the trick and might be a tad quicker.
For speed in perl and assuming no utf-8, this seems a bit quicker.
Update
Examine what is said, not who speaks.
1) When a distinguished but elderly scientist states that something is possible, he is almost certainly right. When he states that something is impossible, he is very probably wrong. 2) The only way of discovering the limits of the possible is to venture a little way past them into the impossible 3) Any sufficiently advanced technology is indistinguishable from magic. Arthur C. Clarke.
In Section
Seekers of Perl Wisdom
|
|