Commit Graph

7 Commits

Author SHA1 Message Date
Marshall Pierce
4d6d81a22c Main decode loop looking more like aklomp's 2017-01-11 14:18:11 -08:00
Marshall Pierce
b681bb62b3 Switch to lookup tables for decoding.
This brings big speedups: over 2x at 100 byte inputs to 6x by 3KiB
and larger. A consequence of this change in logic is that internal
padding characters (a '=' in the middle of base64) is now rejected.
This behavior is allowed per the RFC (4648 s. 3.3), but such
characters were silently ignored before.

On i7-6850K I'm seeing >3 IPC with 0.01% branch mispredict on the
10MiB test. Old code had 1.4 IPC with a pretty hefty 8.46% branch
mispredict.
2016-12-30 14:39:31 -08:00
Marshall Pierce
c518bb947b Add tests for base64 without padding, as well as roundtrip tests
for every possible 1, 2, and 3 byte string (encode, then decode)
and random byte strings up to length 10.
2016-12-30 13:18:05 -08:00
Alice Maz
c9dc498b34 Cleanup 2016-06-12 16:10:53 -07:00
Alice Maz
297f67cfe5 Replace u8{en,de} with {en,de}code_mode. Add URLSafe mode 2016-06-12 15:01:36 -07:00
Alice Maz
b7a2bbc4d5 Change encode's return from Result<String, Err> to Vec<u8> and decode's from Result<String, Err> to Result<Vec<u8>, Err>
Closes #1
2016-06-12 11:53:04 -07:00
Alice Maz
8a473508d2 there's the tests 2015-12-03 18:10:44 -05:00