Closed Thread Icon

Topic awaiting preservation: word counter script slows down when counting a lot of words (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=8232" title="Pages that link to Topic awaiting preservation: word counter script slows down when counting a lot of words (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: word counter script slows down when counting a lot of words <span class="small">(Page 1 of 1)</span>\

 
Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 07-09-2002 00:28

Greets!
http://development.runningwolf.com/code/javascript/word_counter/ is the page I'm dealing with. Basically, a dynamic word counter script that counts the number of words in a form field. The problem is that as the number (to, say 600 or so), the entire script just comes to a crawl.

I'm looking to optimize this so that it's not such a hog. Ideas?

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 07-09-2002 06:36

Try this: http://www.max.co.yu/ozone/word_counter.html

BTW Besides for loop which is seriously slowing this thing (because it has to go through every character on each change), another thing that slows it are two events onkeydown & onkeyup that call it twice (which is unnecessary). On the other hand, my version uses a different approach, it's not 100% optimized, but it is noticeably faster than yours...


« BackwardsOnwards »

Show Forum Drop Down Menu