[Twisted-Python] Re: Twisted 1.0.4 - Heavy search for `plugins.tml'
pinard at iro.umontreal.ca
Mon Apr 28 09:51:03 EDT 2003
> [Francois Pinard]
> > [...] if the number of links of that directory -- itself -- is exactly
> > 2, we can conclude that it has no sub-directories, and that there
> > is nothing more to check for this one.
> The important thing is to make that optimization disabled if link count
> != 2. That is, in any other case you really need to go through the
> stat calls.
If I remember well, GNU `find' keeps the link count for a given directory.
Every time it stats an entry which is a sub-directory, it decreases the
link count. When the link count reaches 2, the loop is exited (provided
`stat' calls are only needed for directory recursion -- `find' sometimes
need them for other purposes).
> A Linux box with enough memory should have really good stat performance
> with a hot cache. [...] But even Linux will suffer the same performance
> problems with a cold cache or too little RAM to cache much.
One may consider that Twisted may also be used on lesser Unices than
Linux -- I'm not going to name any! :-) -- where the performance hit might
hurt more. As a good rule, I think one should not overly rely on various
systems' disk cache, and be on the parsimonious side while accessing disks.
François Pinard http://www.iro.umontreal.ca/~pinard
More information about the Twisted-Python