View Full Version : How fast can javascript be?

12-23-2003, 05:05 PM
I'm currently working on a site that might require the populating of a dropdown, to the tune of 2000 entries or so. I might also try to add functionality where the contents of the <select> change as a user types, so they can narrow the list down.

Is it possible to make this sort of thing execute at an acceptable speed? My current tests say "no" but I know my code is far from the best - should I bother persevering or just give up?


12-23-2003, 05:24 PM
Instead of changing the options in the select element, why not try to use the TypeAheadCombo (http://www.codingforums.com/showthread.php?s=&threadid=9865&perpage=40&pagenumber=3) class I made, based on a bunch of stuff written by this board's own illustrious glenngv?

It's easy to implement, and it'll work on any select element, whether created in the HTML of a page or by scripting.

12-23-2003, 05:34 PM
Very interesting chooper, I guess I should have guessed someone would have done this before :)

12-23-2003, 08:46 PM
Oh I see... Glenngv is the only illustrious person here huh... :confused:... But but but what about me... :p

Nice code, btw... :D


12-23-2003, 08:54 PM
seb put your code in a .js file or in several e.g. one for your code and another for oyur dropdown options.

this will enable the script to be cached by the users browser.


12-24-2003, 12:26 AM
Rendering is slow. If you must populate HTML elements on the fly with lots of children, either create a new replacement in memory, then replaceChild() when it is populated, or maybe try setting display to "none" before populating, populate, then change it back to "block" or whatever.