[phobos] std.base64 replacement

Sean Kelly sean at invisibleduck.org
Mon Oct 11 07:07:12 PDT 2010


It's more an effort to avoid any allocations at all, really, though if the algorithm preallocates a sufficiently sized buffer then that would be acceptable too.  For the actual code I write, I actually decode base64 in-place into the buffer being decoded, which would be a bit weird with ranges anyway.

On Oct 10, 2010, at 9:02 PM, Andrei Alexandrescu wrote:

> If you define encoding and decoding on a range, there's no need to allocate for every pass through the loop. You reuse the buffer.
> 
> @Sean: I doubt you'll see any performance improvement if you encode in-place vs. in a separate buffer.
> 
> 
> Andrei
> 
> On 10/10/10 22:25 CDT, Masahiro Nakagawa wrote:
>> I agree. Last night, I thought about encode / decode with buffer.
>> In range, each memory allocation on loop is bad...
>> 
>> 
>> Masahiro
>> 
>> On Mon, 11 Oct 2010 11:45:08 +0900, Sean Kelly <sean at invisibleduck.org>
>> wrote:
>> 
>>> As others have said, I'd like this to use ranges instead if possible,
>>> and I'd like the option to supply a destination range as well. The
>>> majority of work I do with this sort of thing encodes in-place into
>>> existing buffers.
>>> 
>>> On Oct 10, 2010, at 12:06 AM, Masahiro Nakagawa wrote:
>>> 
>>>> Current std.base64 is not Boost License.
>>>> 
>>>> So, I wrote base64 module.
>>>> 
>>>> http://bitbucket.org/repeatedly/scrap/src/tip/base64.d
>>>> 
>>>> This module is based on RFC4648 and faster than std.base64.
>>>> In addition, User can encode / decode modified Base64 format using
>>>> Base64Impl.
>>>> 
>>>> What do you think?
>>>> 
>>>> 
>>>> Masahiro
>>>> _______________________________________________
>>>> phobos mailing list
>>>> phobos at puremagic.com
>>>> http://lists.puremagic.com/mailman/listinfo/phobos
>>> 
>>> _______________________________________________
>>> phobos mailing list
>>> phobos at puremagic.com
>>> http://lists.puremagic.com/mailman/listinfo/phobos
>> _______________________________________________
>> phobos mailing list
>> phobos at puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/phobos
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos



More information about the phobos mailing list