On Sun, Sep 10, 2017 at 06:58:27PM +0200, Silvan Jegen wrote:
> Hi Hiltjo
>
> Thanks for the review!
>
> On Sat, Sep 09, 2017 at 01:06:21PM +0200, Hiltjo Posthuma wrote:
> > On Sat, Sep 09, 2017 at 11:08:42AM +0200, Silvan Jegen wrote:
> > > From: Jim Beveridge <jimbe_AT_chromium.org>
> > >
> > > The original code is by Jim Beveridge working on Fuchsia. I merged it
> > > with slight changes.
> > >
> >
> > To be clear: is it under the sbase LICENSE?
>
> Yes, from what I can tell the License for this code is the same as for
> the rest of sbase.
>
> > > #define BLKSIZ 512
> > > +// COPY_CHUNK_SIZE must be a power of 2
> > > +#define COPY_CHUNK_SIZE 8192
> > >
> >
> > Instead of COPY_CHUNK_SIZE is might be worthwhile to query the pagesize, but
> > i've not tested it.
>
> Yes, I will have a look.
>
Hey,
A correction of myself: I meant blocksize not pagesize.
Something like this (simplified):
struct stat st;
char *buf;
size_t bufsiz;
int fd;
if (fstat(fd, &st) < 0)
bufsiz = BUFSIZ;
else
bufsiz = MAX(st.st_blksize, BUFSIZ);
buf = ecalloc(1, bufsiz);
for (...) {
n = read(fd, buf, bufsiz);
...
}
I've tested this on a few sbase tools like cat and it significantly increases
throughput. I'll work on a patch.
--
Kind regards,
Hiltjo
Received on Mon Sep 11 2017 - 18:20:05 CEST