Re: [PATCH] base64: provide a fast path for encoding well sized buffers

2013-11-11 Thread Pádraig Brady
On 11/11/2013 06:37 PM, Paul Eggert wrote: > Pádraig Brady wrote: >> + static const char b64c[64] = >> +"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; > ... >> + static const char b64c[64] = >> "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; > >

Re: [PATCH] base64: provide a fast path for encoding well sized buffers

2013-11-11 Thread Paul Eggert
Pádraig Brady wrote: > + static const char b64c[64] = > +"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; ... > + static const char b64c[64] = > "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; There only needs to be one copy of b64c. > + if ((inl

Re: [PATCH] base64: provide a fast path for encoding well sized buffers

2013-11-11 Thread Pádraig Brady
On 11/11/2013 04:07 PM, Pádraig Brady wrote: > --- a/lib/base64.c > +++ b/lib/base64.c > - while (inlen && outlen) > + /* Note the outlen constraint can be enforced at compile time, > + while the inlen can change at runtime at the end of input. > + But the common case when reading large

[PATCH] base64: provide a fast path for encoding well sized buffers

2013-11-11 Thread Pádraig Brady
Avoid conditionals in the central base64 encoding loop, which was seen to give a 60% throughput improvement with the base64 utility from coreutils: $ truncate -s100MiB file.in $ time base64-old -w0 < file.in >/dev/null real 0m0.302s $ time base64-new -w0 < file.in >/dev/null real 0m0.182s * lib