"Kent Johnson" <[EMAIL PROTECTED]> wrote >> application/service. Each time a user inputs a character, the >> character >> is sent to the backend Python program which searches for the >> character >> in a list of >10,000 string items. Once it finds the character, >> the >> backend will return that string and N other adjacent string items >> where >> N can vary from 20 to 150. Each string item is sent back to the JS >> in >> separate print statements. Hence, the for loop. > > You need to look at your real problem and find an appropriate data > structure, rather than showing us what you think is the solution and > asking how to make it faster.
One possibility is that the javascript fetches the list back on the first few characters and caches it on the browser, it can then do the search locally and only go back to the server if the user deletes enough characters to invalidate the cache. That would make a big difference to the overall speed by eliminating several network lookups. I am assuming the server lookup list does not change significantly over the duration of a form submission? Alan G _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor