cosmicperl has asked for the wisdom of the Perl Monks concerning the following question:
I skipped a load of code so it would be easier to read. I've use Benchmark; 'ed this to find it's about 10 times faster.my $maxsize = 1024; my $maxtime = 30; my ($fsize, $ftime) = (stat("click.save"))[7,9]; open(OUTF, ">>click.save"); print OUTF "$ENV{REMOTE_ADDR}|$date|$timestamp\n"; close(OUTF); if ($fsize > $maxsize || ($ftime + $maxtime) < time) { #### Checks all IP's against database using an sql 'WHERE ip I +N ('111.111.111.111, '...)' to find if unique #### Does a bulk insert in one call to the db }#if
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Hit tracking optimization...
by kyle (Abbot) on Jan 24, 2008 at 01:26 UTC | |
by MidLifeXis (Monsignor) on Jan 24, 2008 at 20:30 UTC | |
by cosmicperl (Chaplain) on Jan 25, 2008 at 00:26 UTC | |
by cosmicperl (Chaplain) on Jan 25, 2008 at 00:24 UTC | |
|
Re: Hit tracking optimization...
by chromatic (Archbishop) on Jan 24, 2008 at 02:51 UTC | |
by cosmicperl (Chaplain) on Jan 25, 2008 at 00:40 UTC | |
|
Re: Hit tracking optimization...
by moritz (Cardinal) on Jan 24, 2008 at 08:03 UTC | |
|
Re: Hit tracking optimization...
by roboticus (Chancellor) on Jan 24, 2008 at 13:50 UTC | |
|
Re: Hit tracking optimization...
by BrowserUk (Patriarch) on Jan 24, 2008 at 19:25 UTC | |
by BrowserUk (Patriarch) on Jan 25, 2008 at 01:16 UTC |