Faster base64 encoding for Go

Overview

base64

build-img pkg-img reportcard-img coverage-img

Faster base64 encoding for Go, based on Turbo-Base64.

Features

  • Drop-in replacement of encoding/base64.
    • except for error messages and ignoring \r and \n in decoder.
  • up to 3 times faster than encoding/base64.
  • Dependency-free.

Install

Go version 1.16+

go get github.com/cristalhq/base64

How to use

Replace import statement from encoding/base64 to github.com/cristalhq/base64

-import "encoding/base64"
+import "github.com/cristalhq/base64"

Benchmarks

go1.17 linux/amd64, Intel i7-7700

std/Encode           685.3 ns/op      0 B/op   0 allocs/op
std/EncodeToString   951.8 ns/op   2048 B/op   2 allocs/op
std/Decode           803.9 ns/op      0 B/op   0 allocs/op
std/DecodeString     1061 ns/op    1792 B/op   2 allocs/op

own/Encode           217.8 ns/op      0 B/op   0 allocs/op
own/EncodeToString   353.2 ns/op   1024 B/op   1 allocs/op
own/Decode           426.0 ns/op      0 B/op   0 allocs/op
own/DecodeString     598.7 ns/op    768 B/op   1 allocs/op

go1.17 darwin/arm64, Apple M1

std/Encode           413.0 ns/op       0 B/op  0 allocs/op
std/EncodeToString   608.3 ns/op    2048 B/op  2 allocs/op
std/Decode           372.5 ns/op       0 B/op  0 allocs/op
std/DecodeString     570.2 ns/op    1792 B/op  2 allocs/op

own/Encode           146.7 ns/op       0 B/op  0 allocs/op
own/EncodeToString   246.4 ns/op    1024 B/op  1 allocs/op
own/Decode           222.8 ns/op       0 B/op  0 allocs/op
own/DecodeString     303.1 ns/op     768 B/op  1 allocs/op

Fuzzing

Documentation

See these docs.

License

MIT License.

Releases(v0.1.2)
  • v0.1.2(Aug 25, 2021)

  • v0.1.1(Aug 21, 2021)

  • v0.1.0(Aug 21, 2021)

  • v0.0.5(Aug 19, 2021)

    3ee2b8e6515b1160bb6f3de639e6ac05538423d8 update benchmarks 94ef524a2d801ab80de9e0e98ecf80a96d48b9f9 add fuzzing 4d6ce345ee328872b05db1d0da223a399964ccaa fix decode input checks be4f1c41615009daa25ed078dd8177d43a45628c fix raw decoder 7cb3e0b706cdf335bdbc2a2217706a1f1ee814e9 use predefined error

    Source code(tar.gz)
    Source code(zip)
  • v0.0.4(Aug 18, 2021)

    1fadf5ea50f2dbf309c9b4b00dc5c7fd577861b1 update benchmarks dc80d6b3b8ceb3c747e05f614b3a945bc778c76a fix decoder error d56e85e8e6bba6bf07d45b830080ae913900bfba fix raw decoder

    Source code(tar.gz)
    Source code(zip)
  • v0.0.3(Aug 18, 2021)

    52fd8d58f525acc71a58c7af633ec8cc78902801 update readme 7e4caa0da5760e41fb14a7f142127c9219864ca2 fix goreport ineffassign 0f4ed622b0f231c872b7eb7480dd0e120e6b2901 fix encode/decode empty src

    Source code(tar.gz)
    Source code(zip)
  • v0.0.2(Aug 16, 2021)

Owner
cristaltech
Better open source
cristaltech
Asn.1 BER and DER encoding library for golang.

WARNING This repo has been archived! NO further developement will be made in the foreseen future. asn1 -- import "github.com/PromonLogicalis/asn1" Pac

Logicalis 51 Aug 3, 2022
A high-performance 100% compatible drop-in replacement of "encoding/json"

A high-performance 100% compatible drop-in replacement of "encoding/json" You can also use thrift like JSON using thrift-iterator Benchmark Source cod

Jsoniter 11.2k Aug 11, 2022
Fast implementation of base58 encoding on golang.

Fast Implementation of Base58 encoding Fast implementation of base58 encoding in Go. Base algorithm is adapted from https://github.com/trezor/trezor-c

Denis Subbotin 124 Aug 1, 2022
msgpack.org[Go] MessagePack encoding for Golang

MessagePack encoding for Golang ❤️ Uptrace.dev - All-in-one tool to optimize performance and monitor errors & logs Join Discord to ask questions. Docu

Vladimir Mihailenco 1.8k Aug 12, 2022
GED - Global-purpose Encoding / Decoding library

GED - Global-purpose Encoding / Decoding library This library lets you use common encoding/decoding schemes and allows you to define custom ones. Use

Noémien Kocher 0 Nov 28, 2021
Some Golang types based on builtin. Implements interfaces Value / Scan and MarshalJSON / UnmarshalJSON for simple working with database NULL-values and Base64 encoding / decoding.

gotypes Some simple types based on builtin Golang types that implement interfaces for working with DB (Scan / Value) and JSON (Marshal / Unmarshal). N

null 0 Feb 12, 2022
The web framework for writing faster sites, faster

Gondola The web framework for writing faster sites, faster. Written in Go. View documentation at http://gondolaweb.com. Unless indicated otherwise at

Rainy Cape S.L. 309 Jan 24, 2022
A faster RWLock primitive in Go, 2-3 times faster than RWMutex. A Go implementation of concurrency control algorithm in paper

Go Left Right Concurrency A Go implementation of the left-right concurrency control algorithm in paper <Left-Right - A Concurrency Control Technique w

wangyi 41 Aug 5, 2022
go-eexcel implements encoding and decoding of XLSX like encoding/json

go-eexcel go-eexcel implements encoding and decoding of XLSX like encoding/json Usage func ExampleMarshal() { type st struct { Name string `eexce

sago35 0 Dec 9, 2021
captcha of base64 and diversity

A flexible and various captcha package Base64captcha supports any unicode character and can easily be customized to support Math Chinese Korean Japane

mojocn 1.5k Aug 11, 2022
a little app to gzip+base64 encode and decode

GO=GZIP64 A little golang console utility that reads a file and either: 1) Encodes it - gzip compress followed by base64 encode writes

Steve White 1 Oct 16, 2021
Simple base64 coder/decoder written in Golang

base64-coder simple base64 coder/decoder written in Golang ??️ Releases usage example Encode: ./b64 encode from.txt to.dat Decode: ./b64 encode to.dat

Sagleft 0 Jan 4, 2022
? ID3 decoding and encoding library for Go

id3v2 Supported ID3 versions: 2.3, 2.4 Installation go get -u github.com/bogem/id3v2 Usage example package main import ( "fmt" "log" "github.com

Albert Nigmatzianov 254 Aug 9, 2022
Herbert Fischer 197 Jun 10, 2022
A Go implementation of the Elias-Fano encoding

go-ef A Go implementation of the Elias-Fano encoding Example package main import ( "fmt" "github.com/amallia/go-ef" "os" ) func main() {

Antonio Mallia 21 Jul 19, 2022
Base58 encoding for Go

Base58 encoding for Go Base58 is a less known encoding, but it is popular when embedding resource identifiers into URLs. The encoded data contains onl

Tv 37 Dec 20, 2021
msgpack.org[Go] MessagePack encoding for Golang

MessagePack encoding for Golang ❤️ Uptrace.dev - distributed traces, logs, and errors in one place Join Discord to ask questions. Documentation Refere

Vladimir Mihailenco 1.8k Aug 12, 2022
Go module for encoding structs into URL query parameters

qs Package sonh/qs encodes structs into url.Values. Installation go get github.com/sonh/qs Usage import ( "github.com/sonh/qs" ) Package qs export

Son Huynh 63 Aug 3, 2022
Encoding and decoding GeoJSON <-> Go

go.geojson Go.geojson is a package for encoding and decoding GeoJSON into Go structs. Supports both the json.Marshaler and json.Unmarshaler interfaces

Paul Mach 208 Aug 3, 2022
Package polyline implements a Google Maps Encoding Polyline encoder and decoder.

go-polyline Package polyline implements a Google Maps Encoding Polyline encoder and decoder. Encoding example func ExampleEncodeCoords() { coords :=

Tom Payne 69 Aug 7, 2022
Go package for decoding and encoding TARGA image format

tga tga is a Go package for decoding and encoding TARGA image format. It supports RLE and raw TARGA images with 8/15/16/24/32 bits per pixel, monochro

Sigrid Solveig Haflínudóttir 31 Jul 29, 2022
:eyeglasses: Go library for [d]encoding glTF 2.0 files

gltf A Go module for efficient and robust serialization/deserialization of glTF 2.0, a royalty-free specification for the efficient transmission and l

Quim Muntal 170 Aug 10, 2022
goworker is a Go-based background worker that runs 10 to 100,000* times faster than Ruby-based workers.

goworker goworker is a Resque-compatible, Go-based background worker. It allows you to push jobs into a queue using an expressive language like Ruby w

Benjamin Manns 2.7k Aug 3, 2022
Fast HTTP package for Go. Tuned for high performance. Zero memory allocations in hot paths. Up to 10x faster than net/http

fasthttp Fast HTTP implementation for Go. Currently fasthttp is successfully used by VertaMedia in a production serving up to 200K rps from more than

Aliaksandr Valialkin 18.2k Aug 15, 2022
A simple and light excel file reader to read a standard excel as a table faster | 一个轻量级的Excel数据读取库,用一种更`关系数据库`的方式解析Excel。

Intro | 简介 Expect to create a reader library to read relate-db-like excel easily. Just like read a config. This library can read all xlsx file correct

Back Yu 151 Jul 10, 2022
Asn.1 BER and DER encoding library for golang.

WARNING This repo has been archived! NO further developement will be made in the foreseen future. asn1 -- import "github.com/PromonLogicalis/asn1" Pac

Logicalis 51 Aug 3, 2022
A high-performance 100% compatible drop-in replacement of "encoding/json"

A high-performance 100% compatible drop-in replacement of "encoding/json" You can also use thrift like JSON using thrift-iterator Benchmark Source cod

Jsoniter 11.2k Aug 11, 2022
Fast, powerful, yet easy to use template engine for Go. Optimized for speed, zero memory allocations in hot paths. Up to 20x faster than html/template

quicktemplate A fast, powerful, yet easy to use template engine for Go. Inspired by the Mako templates philosophy. Features Extremely fast. Templates

Aliaksandr Valialkin 2.5k Aug 17, 2022