What david says +
you have a nested loop, that means the running time is propotional to the square of the number of inputs. - I haven't looked too hard either.



David Otton wrote:


On Fri, 28 Nov 2003 03:26:08 -0800, you wrote:



Anybody got a few ideas on how to speed up these two sluggish lines of code? I'm pretty much out of ideas. And if you have any other suggestions to speed things up, I would really appreciate them too.



I know nothing about your application, and I haven't looked too hard at your code.

Having said that, you're not actually displaying 20,000 results on the page
at one time, are you? And even if you did, what user is going to go check
what hit no. 14,879 was? Most of your sort-processing is wasted.

Pass over the array once, throwing away everything with a low relevancy.
Then do your sort. If the user does decide to delve further into the
results, then you can shuffle more of the abandoned stuff back in. But 99%
of your users won't go past the first three pages, and you've saved yourself
a vast amount of processor time.




-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to