{"id":13819446,"url":"https://github.com/powturbo/Turbo-Base64","last_synced_at":"2025-05-16T04:33:49.139Z","repository":{"id":39969330,"uuid":"76740600","full_name":"powturbo/Turbo-Base64","owner":"powturbo","description":"Turbo Base64 - Fastest Base64 SIMD:SSE/AVX2/AVX512/Neon/Altivec - Faster than memcpy!","archived":false,"fork":false,"pushed_at":"2023-08-14T10:21:46.000Z","size":450,"stargazers_count":299,"open_issues_count":5,"forks_count":43,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-03-21T04:41:35.672Z","etag":null,"topics":["arm","avx","avx2","avx512","base64","base64-decoding","base64-encoding","benchmark","encoding","encoding-library","library","neon","simd","sse"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/powturbo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-12-17T18:41:31.000Z","updated_at":"2025-03-13T16:18:49.000Z","dependencies_parsed_at":"2022-09-21T22:04:38.003Z","dependency_job_id":"77d0bbd0-2798-4125-9335-c8d56dfecdda","html_url":"https://github.com/powturbo/Turbo-Base64","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/powturbo%2FTurbo-Base64","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/powturbo%2FTurbo-Base64/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/powturbo%2FTurbo-Base64/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/powturbo%2FTurbo-Base64/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/powturbo","download_url":"https://codeload.github.com/powturbo/Turbo-Base64/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254470300,"owners_count":22076566,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arm","avx","avx2","avx512","base64","base64-decoding","base64-encoding","benchmark","encoding","encoding-library","library","neon","simd","sse"],"created_at":"2024-08-04T08:00:48.008Z","updated_at":"2025-05-16T04:33:48.729Z","avatar_url":"https://github.com/powturbo.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"## Turbo Base64:Fastest Base64 SSE/AVX2/AVX512/Neon/Altivec\n[![Build ubuntu](https://github.com/powturbo/Turbo-Base64/actions/workflows/build.yaml/badge.svg)](https://github.com/powturbo/Turbo-Base64/actions/workflows/build.yaml)\n\n##### **Fastest Base64 SIMD** Encoding library\n * 100% C (C++ headers), as simple as memcpy\n * No other base64 library encode or decode faster\n * :sparkles: **Scalar** can be faster than other SSE or ARM Neon based base64 libraries\n * **SSE** faster than other SSE/AVX/AVX2! base64 library\n * Fastest **AVX2** implementation \n * TurboBase64 AVX2 decoding up to ~2x faster than other AVX2 libs.\n * TurboBase64 is 3,5-4 times faster than other libs for short strings\n * Fastest **ARM Neon** base64\n * :new:(2023.04) avx512 - 2x faster than avx2, faster than any other implementation\n * :+1: Dynamic CPU detection and **JIT scalar/sse/avx/avx2/avx512** switching\n * Base64 robust **error checking**, optimized for **long+short** strings\n * Portable library, 32/64 bits, **SSE/AVX/AVX2/AVX512**, **ARM Neon**, **Power9 Altivec**\n * OS:Linux amd64, arm64, Power9, MacOs+Apple M1, s390x. Windows: Mingw, visual c++\n * Big endian + Little endian\n * Ready and simple to use library, no armada of files, no hassles dependencies\n * **LICENSE GPL 3** . Commercial license available. Contact us at powturbo [_AT_] gmail [_DOT_] com\n\u003cp\u003e\n\t\n------------------------------------------------------------------------\n\t\nDownload Turbo-Base64 executable benchmark tb64app from \n[releases](https://github.com/powturbo/Turbo-Base64/releases/tag/2023.04),\nextract the files and type \"tb64app\"\u003c/br\u003e\n\n## Benchmark incl. the best SIMD Base64 libs:\n- Single thread\n- Including base64 error checking\n- Small file + realistic and practical (no PURE cache) benchmark \n- Unlike other benchmarks, the best of the best scalar+simd libraries are included\n- all libraries with the latest version\n\n#### Benchmark AMD CPU: AMD Ryzen 9 7950X @ 4,50 GHz, DDR5 6000 CL30 - gcc-12.2\n|E Size|ratio%|E MB/s|D MB/s|1,000,000 bytes - 2023.07 |\n|--------:|-----:|--------:|--------:|----------------|\n|1333336|133.33%|**77619**|**76716**|**8:tb64v512vbmi**|\n|1333336|133.33%|41325| 48783| 7:_tb64v256 avx2| \n|1333336|133.33%|45292| 46665| 5:tb64v256  avx2|\n|1000000|100.00%|37047| 31694|10:memcpy        | \n|1333336|133.33%|25077| 28537| 4:tb64v128a avx | \n|1333336|133.33%|24375| 27880| 3:tb64v128      | \n|1333336|133.33%| 9513|  6908| 2:tb64x         | \n|1333336|133.33%| 9513|  5975| 9:_tb64x        | \n|1333336|133.33%| 4914|  5182| 1:tb64s         | \n\n\n|E Size|ratio%|E MB/s|D MB/s|10,000 bytes - 2023.07 |\n|--------:|-----:|--------:|--------:|----------------|\n|13336|133.36%|**89079**|**92006**|**8:tb64v512vbmi**|\n|10000|100.00%|84418|  85703|10:memcpy            |\n|13336|133.36%|34963|  46216| 7:_tb64v256 avx2    |\n|13336|133.36%|40722|  44552| 5:tb64v256  avx2    |\n|13336|133.36%|22601|  27298| 4:tb64v128a avx     |\n|13336|133.36%|21113|  26930| 3:tb64v128          |\n|13336|133.36%| 9648|   6809| 2:tb64x             |\n|13336|133.36%| 9626|   5599| 9:_tb64x            |\n|13336|133.36%| 4937|   5184| 1:tb64s             |\n\n#### Benchmark Intel CPU: i7-9700k 3.6GHz gcc 11.2\n|E Size|ratio%|E MB/s|D MB/s|Name|50,000 bytes - 2022.02 |\n|--------:|-----:|--------:|--------:|----------------|----------------|\n|66668|133.3|**32794**|**37837**|[**tb64v256**](https://github.com/powturbo/TurboBase64)|**Turbo Base64 avx2**|\n|66668|133.3|27789|22264|[b64avx2](https://github.com/aklomp/base64)|aklomp Base64 avx2|\n|66668|133.3|25305|21980|[fb64avx2](https://github.com/lemire/fastbase64)|lemire Fastbase64 avx2|\n|||||||\n|66668|133.3|**17348**|**20686**|[**tb64v128a**](https://github.com/powturbo/TurboBase64)|**Turbo Base64 avx**|\n|66668|133.3|**16035**|**18865**|[**tb64v128**](https://github.com/powturbo/TurboBase64)|**Turbo Base64 sse**|\n|66668|133.3|15820|13078|[b64avx](https://github.com/aklomp/base64)|aklomp Base64 avx|\n|66668|133.3|15322|11302|[b64sse](https://github.com/aklomp/base64)|aklomp Base64 sse41|\n|50000|100.0|47593|47623|memcpy||\n\n|E Size|ratio%|E MB/s|D MB/s|Name| 1 MB - 2022.02|\n|--------:|-----:|--------:|--------:|----------------|----------------|\n|1333336|133.3|**29086**|**29748**|[**tb64v256**](https://github.com/powturbo/TurboBase64)|**Turbo Base64 avx2**|\n|1333336|133.3|26153|22515|[b64avx2](https://github.com/aklomp/base64)|Base64 avx2|\n|1333336|133.3|23686|21231|[fb64avx2](https://github.com/lemire/fastbase64)|Fastbase64 avx2|\n|||||||\n|1333336|133.3|**16897**|**20215**|[**tb64v128a**](https://github.com/powturbo/TurboBase64)|**Turbo Base64 avx**|\n|1333336|133.3|**15932**|**18749**|[**tb64v128**](https://github.com/powturbo/TurboBase64)|**Turbo Base64 sse**|\n|1333336|133.3|15537|12959|[b64avx](https://github.com/aklomp/base64)|Base64 avx|\n|1333336|133.3|15135|11304|[b64sse](https://github.com/aklomp/base64)|Base64 sse41|\n|||||||\n|1333336|133.3|**6546**|**5473**|[**TB64x**](https://github.com/powturbo/TurboBase64)|**Turbo Base64 scalar**|\n|1333336|133.3|6495|4454|[b64plain](https://github.com/aklomp/base64)|Base64 plain|\n|1333336|133.3|1908|2752|[TB64s](https://github.com/powturbo/TurboBase64)|**Turbo Base64 scalar**|\n|1333336|133.3|2541|4289|[chrome](https://github.com/lemire/fastbase64)|Google Chrome base64|\n|1333336|133.3|2670|2299|[fb64plain](https://github.com/lemire/fastbase64)|FastBase64 plain|\n|1333334|135.4|1754|219|[linux](https://github.com/lemire/fastbase64)|Linux base64|\n|1000000|100.0|28688|28656|memcpy||\n\n\u003ca name=\"short\"\u003e\u003c/a\u003e TurboBase64 vs. Base64 for short strings (incl. checking)\n|String length|E MB/s|D MB/s|Name|50,000 bytes - short strings 2022.02 |\n|------------:|--------:|--------:|----------------|----------------|\n| 4 - 16      |**2330**|**2161**|[**TB64avx2**](https://github.com/powturbo/TurboBase64)|**Turbo Base64 avx2**|\n|             |891|734|[b64avx2](https://github.com/aklomp/base64)|Base64 avx2|\n| 8 - 32      |**3963**|**3570**|[**TB64avx2**](https://github.com/powturbo/TurboBase64)|**Turbo Base64 avx2**|\n|             |1348|943|[b64avx2](https://github.com/aklomp/base64)|Base64 avx2|\n| 16 - 64     |**6881**|**5937**|[**TB64avx2**](https://github.com/powturbo/TurboBase64)|**Turbo Base64 avx2**|\n|             |2509|1488|[b64avx2](https://github.com/aklomp/base64)|Base64 avx2|\n| 32 - 128    |**10946**|**8880**|[**TB64avx2**](https://github.com/powturbo/TurboBase64)|**Turbo Base64 avx2**|\n|             |4902|2777|[b64avx2](https://github.com/aklomp/base64)|Base64 avx2|\n\n###### Benchmark ARM Neon: Apple M1 3,5GHz (clang 12.0)\n|E MB/s|size|ratio| D MB/s| 50,000 bytes (2023.08) |\n|--------|-----------:|------:|----------:|-----------------------------|\n|24012.43|66668|133.34%|15352.09|tb64v128 (turbo-base64)|\n|19087.55|66668|133.34%|12515.17|b64neon64 (aklomp/base64)|\n|5611.48|66668|133.34%|5092.64|tb64s|\n|9782.45|66668|133.34%|6798.98|tb64x|\n|6181.37|66668|133.34%|3108.54|b64plain|\n|45566.16|50000|100.00%|45484.13|memcpy|\n\n###### Benchmark ARM Neon: ARMv8 A73-ODROID-N2 1.8GHz (clang 6.0)\n|E Size|ratio%|E MB/s|D MB/s|Name|30MB binary 2019.12|\n|--------:|-----:|--------:|--------:|----------------|----------------|\n|40000000|133.3|**2026**|**1650**|[**TB64neon**](https://github.com/powturbo/TurboBase64)|**Turbo Base64 Neon**|\n|40000000|133.3|1795|1285|[b64neon64](https://github.com/aklomp/base64)|Base64 Neon|\n|40000000|133.3|**1270**|**1095**|[**TB64x**](https://github.com/powturbo/TurboBase64)|**Turbo Base64 scalar**|\n|40000000|133.3|695|965|[TB64s](https://github.com/powturbo/TurboBase64)|**Turbo Base64 scalar**|\n|40000000|133.3|512|782|[fb64neon](https://github.com/lemire/fastbase64)|Fastbase64 SIMD Neon|\n|40000000|133.3|565|460|[Chrome](https://github.com/lemire/fastbase64)|Google Chrome base64|\n|40000000|133.3|642|614|[b64plain](https://github.com/aklomp/base64)|Base64 plain|\n|40000000|133.3|506|548|[fb64plain](https://github.com/lemire/fastbase64)|Fastbase64 plain|\n|40500000|135.4|314|91|[Linux](https://github.com/lemire/fastbase64)|Linux base64|\n|30000000|100.0|3820|3834|memcpy||\n\n- (**bold** = pareto in category)  MB=1.000.000\u003cbr /\u003e\n- (E/D) : Encode/Decode\n- Timmings are respectively relative to the base64 output/input in encode/decode.\n\n\n\u003cp\u003e\n\n## Compile: (Download or clone Turbo Base64 SIMD)\n        git clone https://github.com/powturbo/Turbo-Base64.git\n        make\n\n## Usage: (Benchmark App)\n\n        ./tb64app file \n        or  \n        ./tb64app\n\n## Function usage:\n\n\u003e**static inline unsigned turbob64len(unsigned n)**\u003cbr /\u003e\n\tBase64 output length after encoding\n\n\u003e**unsigned tb64enc(const unsigned char *in, unsigned inlen, unsigned char *out)**\u003cbr /\u003e\n\tEncode binary input 'in' buffer into base64 string 'out'\u003cbr /\u003e\n\twith automatic cpu detection for simd and switch (sse/avx2/scalar\u003cbr /\u003e\n\t**in**          : Input buffer to encode\u003cbr /\u003e\n\t**inlen**       : Length in bytes of input buffer\u003cbr /\u003e\n\t**out**         : Output buffer\u003cbr /\u003e\n\t**return value**: Length of output buffer\u003cbr /\u003e\n\t**Remark**      : byte 'zero' is not written to end of output stream\u003cbr /\u003e\n    \t         \t  Caller must add 0 (out[outlen] = 0) for a null terminated string\u003cbr /\u003e\n\n\n\u003e**unsigned tb64dec(const unsigned char *in, unsigned inlen, unsigned char *out)**\u003cbr /\u003e\n\tDecode base64 input 'in' buffer into binary buffer 'out' \u003cbr /\u003e\n\t**in**          : input buffer to decode\u003cbr /\u003e\n\t**inlen**       : length in bytes of input buffer \u003cbr /\u003e\n\t**out**         : output buffer\u003cbr /\u003e\n\t**return value**: \u003e0 output buffer length\u003cbr /\u003e\n                      0 Error (invalid base64 input or input length = 0)\u003cbr /\u003e\n\n### Environment:\n\n###### OS/Compiler (32 + 64 bits):\n- Windows: Visual C++ (2017)\n- Windows: MinGW-w64 makefile\n- Linux amd/intel: GNU GCC (\u003e=4.6)\n- Linux amd/intel: Clang (\u003e=3.2) \n- Linux arm: aarch64 ARMv8 Neon: gcc (\u003e=6.3) \n- Linux arm: aarch64 ARMv8 Neon: clang (\u003e=6.0) \n- MaxOS: XCode (\u003e=9), apple M1\n- PowerPC ppc64le: gcc (\u003e=8.0) incl. SIMD Altivec\n\n###### References:\n- [fastbase v2022.02](https://github.com/lemire/fastbase64)\n- [base64 v2022.02](https://github.com/aklomp/base64)\n- [base64simd](https://github.com/WojciechMula/base64simd)\n\n###### * **SIMD Base64 publications:**\n  * :green_book:[Faster Base64 Encoding and Decoding Using AVX2 Instructions](https://arxiv.org/abs/1704.00605)\n  * :green_book:[RFC 4648:The Base16, Base32, and Base64 Data Encodings](https://tools.ietf.org/html/rfc4648)\n\nLast update: 06 AUG 2023\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpowturbo%2FTurbo-Base64","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpowturbo%2FTurbo-Base64","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpowturbo%2FTurbo-Base64/lists"}