There's more than one way to do things | |
PerlMonks |
utime vs. open/closeby jjhorner (Hermit) |
on Jun 19, 2000 at 19:20 UTC ( [id://18804]=perlmeditation: print w/replies, xml ) | Need Help?? |
I was looking at maintaining activity time by checking the last access time of a file, and when a user was active, it would update the access time of a file. To try to streamline my code, I wanted to see if 'utime' was faster than 'open/close', so I wrote the following benchmark:
No matter how many iterations I tried, it always returned really low results:
So, I decided to add a stumbling block to both subroutines:
The results returned much better, but still not really promising:
While the benchmark told me that it only took 1 wallclock sec, it really took 10 or 15 seconds. So, my meditation is this: Should there be a better method of benchmarking this type of test, or should I find a better way to benchmark? The test, while far from infallible, should give reasonable results. It doesn't however. Is 'utime' better than 'open/close' or vice versa? Is this all a method of system performance on I/O? Is this question even worth asking?jj
Back to
Meditations
|
|