An easy to decode base64 modification.

Related tags

Miscellaneous base64
Overview

crzy64

An easy to decode base64 modification.

This is a base64 modification designed to simplify the decoding step.

For the four encoded bytes, it only takes 12 operations (+ - & ^ << >>) to convert them to 24 bits of data. Using 64-bit or vector instructions makes decoding even more efficient.

But it's bound to ASCII character codes and will not work with other encodings like EBCDIC.

There is a difference with base64 as it uses "./" instead of "+/" and the data is also pre-shuffled to speed up decoding.

Build

$ make all check

Benchmark

  • "size" refers to processing of that amount of data between time measurements.

  • "unaligned" for tests means processing data from unaligned pointers.

  • "block repeat" means repeating processing of the same block of a specified size until the total "size" is reached.

$ make bench
./crzy64_bench
vector: avx2, fast64: yes, unaligned: yes
size: 100 MB

memcpy: 7.911ms (12640.63 MB/s)
encode: 16.540ms (6045.95 MB/s)
decode: 14.586ms (6855.89 MB/s)
encode_unaligned: 16.514ms (6055.47 MB/s)
decode_unaligned: 14.579ms (6859.18 MB/s)

block repeat:
memcpy (1Kb): 1.115ms (89686.10 MB/s)
encode (1Kb): 14.567ms (6864.83 MB/s)
decode (1Kb): 6.557ms (15250.88 MB/s)
memcpy (10Kb): 1.443ms (69300.07 MB/s)
encode (10Kb): 12.308ms (8124.80 MB/s)
decode (10Kb): 5.708ms (17519.27 MB/s)
memcpy (100Kb): 2.394ms (41771.09 MB/s)
encode (100Kb): 12.307ms (8125.46 MB/s)
decode (100Kb): 7.094ms (14096.42 MB/s)
memcpy (1Mb): 3.212ms (31133.25 MB/s)
encode (1Mb): 12.501ms (7999.36 MB/s)
decode (1Mb): 7.578ms (13196.09 MB/s)
memcpy (10Mb): 7.053ms (14178.36 MB/s)
encode (10Mb): 16.046ms (6232.08 MB/s)
decode (10Mb): 13.656ms (7322.79 MB/s)
memcpy (20Mb): 7.594ms (13168.29 MB/s)
encode (20Mb): 16.217ms (6166.37 MB/s)
decode (20Mb): 14.173ms (7055.67 MB/s)
You might also like...
A lib to encode/decode Joycon Bluetooth packet.

libjoycon A Joycon packet encoding and decoding lib Build The library itself only links to the libm (math lib): mkdir build && cd build cmake .. make

Handcrafted Flutter application well organized and easy to understand and easy to use.

Handcrafted Flutter application well organized and easy to understand and easy to use.

Easy Anti PatchGuard

EasyAntiPatchGuard ##Support System = Win8 (Win8 - Win10 21H4) How to use 1.Build EasyAntiPatchGuard.sln 2.Load EasyAntiPatchGuard.sys Detail as we kn

Simple and easy script language for your dead brain, or break time of you.

What is this trush? Shut up, this isnt a trush. Lol This is a easy and simple script language. Change the world. Rotation the world. BIG REVOLUTION OF

Off The Grid (OTG) Messenger is an easy way for people to communicate through text messages when in remote areas.
Off The Grid (OTG) Messenger is an easy way for people to communicate through text messages when in remote areas.

Off The Grid (OTG) Messenger is an easy way for people to communicate through text messages when in remote areas. With a theoretical transmission range of 10 miles (16kms), OTG messenger can be used by groups of people to stay connected when they are in areas not serviced by mobile connectivity.

Hobbyist Operating System targeting x86_64 systems. Includes userspace, Virtual File System, An InitFS (tarfs), Lua port, easy porting, a decent LibC and LibM, and a shell that supports: piping, file redirection, and more.
Hobbyist Operating System targeting x86_64 systems. Includes userspace, Virtual File System, An InitFS (tarfs), Lua port, easy porting, a decent LibC and LibM, and a shell that supports: piping, file redirection, and more.

SynnixOS Epic Hobby OS targeting x86_64 CPUs, it includes some hacked together functionality for most essential OSs although, with interactivity via Q

A Flutter package that makes it easy to customize and work with your Flutter desktop app's system tray.
A Flutter package that makes it easy to customize and work with your Flutter desktop app's system tray.

system_tray A Flutter package that that enables support for system tray menu for desktop flutter apps. on Windows, macOS and Linux. Features: - Modify

Memory Process File System (MemProcFS) is an easy and convenient way of viewing physical memory as files in a virtual file system
Memory Process File System (MemProcFS) is an easy and convenient way of viewing physical memory as files in a virtual file system

The Memory Process File System (MemProcFS) is an easy and convenient way of viewing physical memory as files in a virtual file system.

Trident provides an easy way to pass the output of one command to any number of targets.

Trident: The multiple-pipe system Trident provides an easy way to pipe the output of one command to not just one but many targets. These targets can b

Comments
  • Comparison to existing SIMD base64 implementations.

    Comparison to existing SIMD base64 implementations.

    It would be nice if there were some direct comparison to base64 projects that use SSSE3, AVX2 or AVX-512. It would be nice to know if this actually beats state of the art base64 decoders, but it is a little hard to fairly compare without equivalent benchmarks.

    Turbo-Base64 would be a good target because it includes a bunch of benchmarks to other code and seems to be the SOTA. Based on comparisons to memcpy I would actually expect this to be substantially slower than TurboBase SSE.

    opened by TheThirdOne 4
Owner
Ilya Kurdyukov
Optimization, porting, SIMD, image processing.
Ilya Kurdyukov
A fast base64 module for React Native

react-native-quick-base64 A native implementation of Base64 in C++ for React Native. 4x faster than base64-js on an iPhone 11 Pro.

Takuya Matsuyama 228 Dec 18, 2022
C library containing useful base64 related functions.

b64 C library containing useful fast base64 related functions. Usage Get the library: It's very simple to use it, run the "build_lib.sh" shell script

null 5 May 8, 2022
MiniDumpWriteDump behavior modification hook

MiniDumpWriteDumpPoC MiniDumpWriteDump behavior modification hook Read the full article in our blog: Adepts Of 0xCC: Hooks On Hoot Off This is a funct

Adepts of 0xCC 48 Nov 9, 2022
GlueGD is a mod loader for Geometry Dash that does not require a modification to any existing Geometry Dash files or an external injector or launcher.

GlueGD is a mod loader for Geometry Dash that does not require a modification to any existing Geometry Dash files or an external injector or la

Aly Cerruti 9 Apr 10, 2022
Tomb Raider III multiplayer modification.

Tomb Raider III Multiplayer Mod. Multiplayer Modification for Tomb Raider III. Website: https://tr3mp.net/ If you own the base source of \patch projec

Tony 3 Dec 25, 2021
Project is to port original Zmodem for Unix to CP/M and provide binaries and source code for platform specific modification as needed. Based on 1986 C source code by Chuck Forsberg

Zmodem-CP-M This repository is intended to foster a RetroBrewComputers community effort to port the original Zmodem source code for Unix to CP/M so ev

null 11 Aug 31, 2022
Project is to port original Zmodem for Unix to CP/M and provide binaries and source code for platform specific modification as needed. Based on 1986 C source code by Chuck Forsberg

Zmodem4CPM This repository is intended to foster a RetroBrewComputers community effort to port the original Zmodem source code for Unix to CP/M so eve

null 11 Aug 31, 2022
「⚙️」Simple header for C language to encode and decode hex

「 ⚙️ 」Simple header for C language to encode and decode hex Example: Encode: #include <stdio.h> #include <string.h> #include <stdlib.h> #include "hex.

null 3 Jan 1, 2023
gr-nrf24-sniffer is a tool to receive and decode wireless traffic from nRF24L01(+) modules

gr-nrf24-sniffer What is this? gr-nrf24-sniffer is a tool to receive and decode wireless traffic from nRF24L01(+) modules (or older nRF24xxx) using GN

null 5 Jul 18, 2022
yariv.h is a single C/C++ header to encode and decode SPIR-V shaders into a more compressed form I've called YARI-V.

YARI-V yariv.h is a single C/C++ header to encode and decode SPIR-V shaders into a more compressed form I've called YARI-V. YARI-V is an alternative e

Neil Henning 31 Dec 8, 2022