On Sat, 2007-08-11 at 09:29 -0400, Matt Sergeant wrote:
> On 11-Aug-07, at 9:19 AM, Guy Hulbert wrote:
> 
> > On Sat, 2007-08-11 at 08:29 +0200, Hanno Hecker wrote:
> >> +    while (my $size = $fh->read(my $line, 4096)) {
> >
> > Is 4096 the file system block size ?  Not every file system uses 4k
> > though it is a common default.  I suspect that using the exact  
> > value for
> > the queue file system will give the best results.
> 
> In previous tests I've done with perl you're better off just trying  
> to read about a megabyte at a time. Sounds strange, but try it.

I was being stupid ... these days the optimal size is probably some
fraction of the cache size on the hard-drive ... hence the results you
see.  

But the block size is much faster than reading line-by-line.  I just
check the size of the file on the disk and suck it all in at once
(rather than reading line-by-line) unless it's bigger than 10MB or so.
I wrote a class to do this so I can forget about it.

> 
> Matt.
> 

-- 
--gh


Reply via email to