bug-tar
[Top][All Lists]
Advanced

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

Re: [PATCH 1/2] add option to set the offset of the archive


From: Matteo Croce
Subject: Re: [PATCH 1/2] add option to set the offset of the archive
Date: Thu, 24 Oct 2024 19:26:07 +0200

Il giorno gio 24 ott 2024 alle ore 19:09 Matteo Croce
<technoboy85@gmail.com> ha scritto:
>
> Il giorno gio 24 ott 2024 alle ore 18:56 Marius Spix
> <marius.spix@web.de> ha scritto:
> >
> > Mhhhh,
> >
> > char *buf = xmalloc (offset_option);
> > ...
> > free (buf);
> >
> > Reading lots of data into a huge buffer just to free it later does not 
> > sound like a good idea. There are more efficient ways to fast-forward a 
> > tape or to receive a file stream starting at a certain offset (pipe dd 
> > through tar).
> >
>
> Hi,
> yes, the buffer could be big. A better option could be to lseek(), but
> that won't work with pipes.
> Alternatively, I could create a decent sized buffer, e.g. a few Kb,
> and read in a loop until needed.
>
> I know that it's possible to pipe the stream with an external process,
> but there are some use cases where a seekable file descriptor is
> preferable.
> One for all, listing the content of a huge archive is much faster when
> tar can seek forward.
>

Just to have some real world numbers:

$ time tar tf linux-6.11.5.tar >/dev/null

real 0m0.169s
user 0m0.079s
sys 0m0.087s
$ time cat linux-6.11.5.tar |tar t >/dev/null

real 0m1.620s
user 0m0.119s
sys 0m0.717s

Regards,
-- 
Matteo Croce

perl -e 'for($t=0;;$t++){print chr($t*($t>>8|$t>>13)&255)}' |aplay



reply via email to

[Prev in Thread] Current Thread [Next in Thread]