marshallpierce / rust-base64

base64, in rust
Apache License 2.0
606 stars 113 forks source link

`DecoderReader` probably should accept `BufRead` instead of `Read` #230

Open Kixunil opened 1 year ago

Kixunil commented 1 year ago

I noticed DecoderReader holds its internal buffer of bytes. This has a number of disadvantages:

Unless I'm missing something this can be easily fixed just by requiring BufRead instead of Read and using it. It's a breaking change so it's better to do it before 1.0.

Related: maybe it itself could provide BufRead but I'm not sure if 3-byte buffer is fine or not.

Kixunil commented 1 year ago

I was curious enough to give it a shot and indeed, this improves performance. See the PR.