[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
- [PATCH 1/2] add option to set the offset of the archive, Matteo Croce, 2024/10/24
- [PATCH 2/2] add test for --offset, Matteo Croce, 2024/10/24
- Aw: [PATCH 1/2] add option to set the offset of the archive, Marius Spix, 2024/10/24
- Re: [PATCH 1/2] add option to set the offset of the archive, Matteo Croce, 2024/10/24
- Re: [PATCH 1/2] add option to set the offset of the archive,
Matteo Croce <=
- Re: [PATCH 1/2] add option to set the offset of the archive, Paul Eggert, 2024/10/25
- Re: [PATCH 1/2] add option to set the offset of the archive, Matteo Croce, 2024/10/25
- Re: [PATCH 1/2] add option to set the offset of the archive, Matteo Croce, 2024/10/30
- Re: [PATCH 1/2] add option to set the offset of the archive, Sergey Poznyakoff, 2024/10/31
- Re: [PATCH 1/2] add option to set the offset of the archive, Matteo Croce, 2024/10/31
- Re: [PATCH 1/2] add option to set the offset of the archive, Sergey Poznyakoff, 2024/10/31
- Re: [PATCH 1/2] add option to set the offset of the archive, Matteo Croce, 2024/10/31
- Re: [PATCH 1/2] add option to set the offset of the archive, Sergey Poznyakoff, 2024/10/31
- Re: [PATCH 1/2] add option to set the offset of the archive, Matteo Croce, 2024/10/31
Re: [PATCH 1/2] add option to set the offset of the archive, Sergey Poznyakoff, 2024/10/24