Re: Beagle CPU usage (was Proposed module: tracker)



Le mardi 27 mars 2007 à 17:13 -0600, Hans Petter Jansson a écrit :
> On Wed, 2007-03-28 at 00:28 +0200, Xavier Bestel wrote:
> > On mar, 2007-03-27 at 14:52 -0600, Federico Mena Quintero wrote:
> 
> > > [/me wonders if thumbnailers are measurably faster by using mmap()
> > > instead of read()...]
> 
> > It depends on their access pattern. If they need sequential access,
> > read() is better because it can do prefetching (readahead).
> 
> I think what Federico was getting at is that for most thumbnailers,
> rendering is likely to be a bigger bottleneck than I/O on a local file
> system. But we don't know this for sure until we've measured it.

Linus seems to agree with you wrt real-world testing:
http://gcc.gnu.org/ml/gcc-patches/2001-09/msg00358.html

> mmap() can do prefetching too - and it will likely load a 4k page at a
> time anyway. So I doubt prefetch plays a role in a comparison of read()
> and mmap().
> 
> I tend to favor read() on user data:
> 
> - For robustness: An mmap() map can become invalid if the file is
> truncated, crashing the process.
> - Because mmap() makes your VSize - and with accesses, your RSS - grow
> correspondingly, with subsequent bug reports from irate users.

Sure.

	Xav





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]