RadLikeWhoa / Countable

Add live paragraph-, word- and character-counting to an HTML element.
https://sacha.me/Countable
MIT License
1.64k stars 134 forks source link

Better Performance on Counting #2

Closed epmatsw closed 11 years ago

epmatsw commented 11 years ago

Removed unnecessary split from character count, switched paragraph and word counts to use match rather than replace+split.

As far as I can tell, this code should produce the same results in about half of the time.

Benchmarks: http://jsperf.com/wds1/6

RadLikeWhoa commented 11 years ago

Thanks a lot for pointing it out, didn't know about that. :)