[lug] Polling a file under linux
ed at eh3.com
Mon Apr 21 16:04:50 MDT 2003
On Mon, 2003-04-21 at 14:04, Sean Reifschneider wrote:
> On Mon, Apr 21, 2003 at 11:57:04AM -0500, Rob Judd wrote:
> >1. read the contents of the file before every connection
> >2. stat the file before every connection
> >both of these are rather expensive, especially if connections are made
> >several times a second.
> I guess it depends on what you mean by "expensive". On my laptop, it
> looks like I can do a stat in a C program in about 1/450,000th of a
> second. In Python this drops down to being about 1/65,000th of a
> second. So, if by "several times a second" you mean several thousand
> times a second, I'd agree that stat() may be a bit expensive...
> Remember, premature optimization is the root of all evil. The first
> rule of optimization is: Don't do it...
You give it way too much credit. Its more like "a root of some evil".
There are *myriad* ways to botch things and premature optimization is
only one of them.
Edward H. Hill III, PhD
Division of ESE, Colorado School of Mines, Golden, CO 80401
Email: ed at eh3.com ehill at mines.edu
URLs: http://cesep.mines.edu/people/hill.htm http://eh3.com
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 189 bytes
Desc: This is a digitally signed message part
More information about the LUG