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

Denis Vlasenko vda at ilport.com.ua
Thu Mar 2 01:19:14 PST 2006


Hi Rob,

This patch speeds up tar by stop padding blocks with
for (...TAR_BLOCK_SIZE...) write(fd, "\0", 1);

Tarring up bbox build tree.
90% of all syscalls are 1 byte writes:

# (strace ./busybox_org_tar tar cf - . >/dev/null) 2>&1 | wc -l
620174
# (strace ./busybox_new_tar tar cf - . >/dev/null) 2>&1 | wc -l
53919

# time sh -c 'for a in `seq 1 50`; do ./busybox_org_tar tar cvf - . >/dev/null 2>&1; done'
real    0m38.941s
user    0m11.125s
sys     0m21.289s
# time sh -c 'for a in `seq 1 50`; do ./busybox_new_tar tar cvf - . >/dev/null 2>&1; done'
real    0m19.530s
user    0m5.088s
sys     0m10.953s

Downside: +60 bytes in text segment on i386

# size busybox_org_tar busybox_new_tar
   text    data     bss     dec     hex filename
  28898     560  792824  822282   c8c0a busybox_org_tar
  28958     560  792856  822374   c8c66 busybox_new_tar
--
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tar_coalesce_writes.patch
Type: text/x-diff
Size: 3340 bytes
Desc: not available
Url : http://busybox.net/lists/busybox/attachments/20060302/05ce6127/tar_coalesce_writes.bin


More information about the busybox mailing list