On Tuesday 01 February 2005 18:34, Nuno Lopes wrote:
nlopess Tue Feb 1 12:34:44 2005 EDT
Modified files:
/docweb/scripts notes_stats.php
Log:
major script tuning:
improved speed
I don't know your machine, but on mine I only notice that it have to take a 15
minutes break for the script to finish the query (not counting the download
time)
and the /www script seems to take 5 seconds instead of 0.25 seconds that the
orignal version used (on my machine)
Also the huge database it not needed at all, only wasting disk space
ls -l notes_stats.sqlite*
-rw-r--r-- 1 Allowee Allowee 3975168 Feb 3 15:25 notes_stats.sqlite
-rw-r--r-- 1 Allowee Allowee 158720 Jan 31 22:22 notes_stats.sqlite.old
I have to agree that the old version could be improved even more, by only
inserting the top 20 files instead of all files is a good tweak..
Would be nice to hear why everything has to be changed while the orginal
version worked quite fine.
My main machine is a Pentium4 2 Ghz with PHP 5.1. And the program is fast (although slower than the original).
I think the original script was quite a mess, indentation broken,... And the most important thing: it had the logic broken.
It splitted the notes by old/new in the cron job, which is wrong, because this is a comulative script. Over the time, older notes wouldn't be marked as such.
What I've done is to create a database with all notes. This may seem a slow process for the first time, but following runs are faster.
So, the presentation code shouldn't be in the cron script. Now we have two choices: generate the old DB schema, collecting data from the new one; or simply cache the results. The orphan notes cron job generates a static file. The same thing could be done with this script.
Nuno
P.S.: As usual, I don't mind to revert my changes