github.com/cristalhq/base64@v0.1.2/README.md (about)

     1  # base64
     2  
     3  [![build-img]][build-url]
     4  [![pkg-img]][pkg-url]
     5  [![reportcard-img]][reportcard-url]
     6  [![coverage-img]][coverage-url]
     7  
     8  Faster base64 encoding for Go, based on [Turbo-Base64](https://github.com/powturbo/Turbo-Base64).
     9  
    10  ## Features
    11  
    12  * Drop-in replacement of `encoding/base64`.
    13    * _except for error messages and ignoring `\r` and `\n` in decoder._
    14  * up to 3 times faster than `encoding/base64`.
    15  * Dependency-free.
    16  
    17  ## Install
    18  
    19  Go version 1.16+
    20  
    21  ```
    22  go get github.com/cristalhq/base64
    23  ```
    24  
    25  ## How to use
    26  
    27  Replace import statement from `encoding/base64` to `github.com/cristalhq/base64`
    28  
    29  ```diff
    30  -import "encoding/base64"
    31  +import "github.com/cristalhq/base64"
    32  ```
    33  
    34  # Benchmarks
    35  
    36  go1.17 linux/amd64, Intel i7-7700
    37  
    38  ```
    39  std/Encode           685.3 ns/op      0 B/op   0 allocs/op
    40  std/EncodeToString   951.8 ns/op   2048 B/op   2 allocs/op
    41  std/Decode           803.9 ns/op      0 B/op   0 allocs/op
    42  std/DecodeString     1061 ns/op    1792 B/op   2 allocs/op
    43  
    44  own/Encode           217.8 ns/op      0 B/op   0 allocs/op
    45  own/EncodeToString   353.2 ns/op   1024 B/op   1 allocs/op
    46  own/Decode           426.0 ns/op      0 B/op   0 allocs/op
    47  own/DecodeString     598.7 ns/op    768 B/op   1 allocs/op
    48  ```
    49  
    50  go1.17 darwin/arm64, Apple M1
    51  
    52  ```
    53  std/Encode           413.0 ns/op       0 B/op  0 allocs/op
    54  std/EncodeToString   608.3 ns/op    2048 B/op  2 allocs/op
    55  std/Decode           372.5 ns/op       0 B/op  0 allocs/op
    56  std/DecodeString     570.2 ns/op    1792 B/op  2 allocs/op
    57  
    58  own/Encode           146.7 ns/op       0 B/op  0 allocs/op
    59  own/EncodeToString   246.4 ns/op    1024 B/op  1 allocs/op
    60  own/Decode           222.8 ns/op       0 B/op  0 allocs/op
    61  own/DecodeString     303.1 ns/op     768 B/op  1 allocs/op
    62  ```
    63  
    64  # [Fuzzing](fuzz)
    65  
    66  ## Documentation
    67  
    68  See [these docs][pkg-url].
    69  
    70  ## License
    71  
    72  [MIT License](LICENSE).
    73  
    74  [build-img]: https://github.com/cristalhq/base64/workflows/build/badge.svg
    75  [build-url]: https://github.com/cristalhq/base64/actions
    76  [pkg-img]: https://pkg.go.dev/badge/cristalhq/base64
    77  [pkg-url]: https://pkg.go.dev/github.com/cristalhq/base64
    78  [reportcard-img]: https://goreportcard.com/badge/cristalhq/base64
    79  [reportcard-url]: https://goreportcard.com/report/cristalhq/base64
    80  [coverage-img]: https://codecov.io/gh/cristalhq/base64/branch/master/graph/badge.svg
    81  [coverage-url]: https://codecov.io/gh/cristalhq/base64