[Tutor] List comprehensions
alan.gauld at btinternet.com
Thu Apr 10 14:32:48 CEST 2008
"Kent Johnson" <kent37 at tds.net> wrote
>> application/service. Each time a user inputs a character, the
>> is sent to the backend Python program which searches for the
>> in a list of >10,000 string items. Once it finds the character,
>> backend will return that string and N other adjacent string items
>> N can vary from 20 to 150. Each string item is sent back to the JS
>> 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.
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?
More information about the Tutor