[PATCH] speedup tar by greatly reducing number of write() syscalls

Rob Landley rob at landley.net
Thu Mar 2 22:42:01 UTC 2006


On Thursday 02 March 2006 12:53 pm, Wolfgang Denk wrote:
> In message <200603021119.14610.vda at ilport.com.ua> you wrote:
> > This patch speeds up tar by stop padding blocks with
> > for (...TAR_BLOCK_SIZE...) write(fd, "\0", 1);
>
> ...
>
> > Downside: +60 bytes in text segment on i386
>
> ...plus TAR_BLOCK_SIZE bytes on the heap.

512, not the end of the world.

I redid the patch to use bb_common_bufsiz1.  I'm not sure it's a size win or 
not, it's "close and different".  I'll check one or the other in this 
evening...

> Ummm... is it true that none of these write()s does any eror checking
> at all? Ouch...

Apparently so.  (As long as the _last_ write we do is checked for errors, 
we're probably ok in the common case.  I can imagine some strange race 
condition where the disk fills up a file gets deleted shortly afterwards.  
Would the write then resume, or is it in an error state from then on?  If it 
did resume, would it result in a sparse file, which is ok for null byte 
writes anyway...?)

> Best regards,
>
> Wolfgang Denk

Rob
-- 
Never bet against the cheap plastic solution.



More information about the busybox mailing list