Replace legacy Base64 implementation with libbase64 - #116
Conversation
Keep the existing UUBlock INI format while enabling SIMD-accelerated encoding and decoding
| int outcount = b64pipe.Put(buffer, length); | ||
| total += outcount; | ||
| int filtered_count = 0; | ||
| for (int offset = 0; offset < length; offset++) { |
There was a problem hiding this comment.
What is all this, why is it needed?
The input should already be base64, I dont think the original implementation deviated?
There was a problem hiding this comment.
The original decoder was different here: Base64_Decode explicitly ignored every character outside the Base64 alphabet and stopped at the first "=" character. Get_UUBlock reached it via Base64Pipe, so the existing permissive decoding behavior for old INI data is preserved.
I agree that this is more code than is required for the normal path.
filtering exists only for compatibility with the old decoder.
If we do not consider support for damaged/non-standard UUBlocks important, then the code in this place can be greatly simplified
| * * | ||
| * HISTORY: * | ||
| * 07/02/1996 JLB : Created. * | ||
| * 09/02/2026 Belonit : Switched Base64 decoding to libbase64. * |
There was a problem hiding this comment.
Generally we don't modify official comments, if we have to be modified they become our comment format, in History case not sure what to do yet..
There was a problem hiding this comment.
I don't quite understand how to deal with comments specifically in this case
There was a problem hiding this comment.
I've been amending WW comments when the change isn't fundamental. don't update the history notes tho.
|
Is there a benchmark driven reason for this? |
|
Can we keep the pipe/straw classes? They're idiomatic here. Replace the actual base64 impl instead? |
UUBlock encoding and decoding are not per-frame hot paths, so I do not think a benchmark is necessary. libbase64 should still be significantly faster for large blocks, and I can measure that if useful. The primary motivation was maintenance: the bespoke codec plus Base64Pipe and Base64Straw were only used for UUBlock handling. libbase64 replaces that isolated implementation with a tested library while preserving the stored format |
We can, but these are not general-purpose adapters in the current tree: Base64Pipe and Base64Straw are only used by the two UUBlock functions. They also buffer a single Base64 quantum ( Keeping them is reasonable if preserving the local Pipe/Straw shape is more important than removing the unused abstraction. Otherwise, I think calling the library directly is the simpler result. |
The custom Base64 codec is legacy code used only for INI UUBlock serialization.
This replaces it with SIMD-accelerated libbase64 while keeping the existing UUBlock format compatible.
The work is split into four commits:
Package third-party licenses with releasesis the same change as Package third-party licenses with releases #115.I would prefer Package third-party licenses with releases #115 to be merged first, so this commit can be dropped when the branch is rebased.
Add INI UUBlock compatibility testsrecords the behavior of the old implementation before replacing it.Replace legacy Base64 implementation with libbase64replaces the codec and removes its unused stream adapters.Update INI UUBlock compatibility testsmakes the same tests build against the new implementation.The Base64 test changes are separate because I am not sure whether they should be included upstream.