mirror of
https://github.com/fumiama/go-base16384.git
synced 2026-06-05 00:32:52 +08:00
goos: darwin goarch: arm64 pkg: github.com/fumiama/go-base16384 name old time/op new time/op delta EncodeTo/16-8 10.6ns ± 0% 9.8ns ± 1% -7.60% (p=0.008 n=5+5) EncodeTo/256-8 80.8ns ± 0% 56.0ns ± 0% -30.72% (p=0.008 n=5+5) EncodeTo/4K-8 1.21µs ± 0% 0.82µs ± 1% -32.34% (p=0.016 n=4+5) EncodeTo/32K-8 9.64µs ± 0% 6.52µs ± 1% -32.36% (p=0.008 n=5+5) DecodeTo/16-8 9.79ns ± 0% 6.33ns ± 1% -35.29% (p=0.016 n=4+5) DecodeTo/256-8 80.9ns ± 0% 52.6ns ± 1% -34.98% (p=0.008 n=5+5) DecodeTo/4K-8 1.22µs ± 0% 0.78µs ± 1% -35.91% (p=0.008 n=5+5) DecodeTo/32K-8 9.71µs ± 1% 6.21µs ± 1% -36.01% (p=0.008 n=5+5) Encoder/16-8 76.5ns ± 0% 76.2ns ± 0% -0.42% (p=0.008 n=5+5) Encoder/256-8 356ns ± 0% 290ns ± 0% -18.39% (p=0.008 n=5+5) Encoder/4K-8 4.05µs ± 0% 3.70µs ± 0% -8.65% (p=0.008 n=5+5) Encoder/32K-8 34.1µs ± 0% 29.2µs ± 0% -14.22% (p=0.008 n=5+5) Decoder/16-8 205ns ± 0% 207ns ± 1% +1.28% (p=0.008 n=5+5) Decoder/256-8 262ns ± 0% 246ns ± 1% -6.05% (p=0.008 n=5+5) Decoder/4K-8 1.49µs ± 0% 1.12µs ± 0% -24.48% (p=0.008 n=5+5) Decoder/32K-8 11.0µs ± 0% 8.1µs ± 1% -26.64% (p=0.008 n=5+5) name old speed new speed delta EncodeTo/16-8 1.50GB/s ± 0% 1.63GB/s ± 1% +8.22% (p=0.008 n=5+5) EncodeTo/256-8 3.17GB/s ± 0% 4.57GB/s ± 0% +44.35% (p=0.008 n=5+5) EncodeTo/4K-8 3.37GB/s ± 0% 4.99GB/s ± 1% +47.78% (p=0.008 n=5+5) EncodeTo/32K-8 3.40GB/s ± 0% 5.02GB/s ± 1% +47.85% (p=0.008 n=5+5) DecodeTo/16-8 2.25GB/s ± 0% 3.47GB/s ± 1% +54.53% (p=0.016 n=4+5) DecodeTo/256-8 3.66GB/s ± 0% 5.63GB/s ± 1% +53.81% (p=0.008 n=5+5) DecodeTo/4K-8 3.84GB/s ± 0% 6.00GB/s ± 1% +56.05% (p=0.008 n=5+5) DecodeTo/32K-8 3.86GB/s ± 1% 6.03GB/s ± 1% +56.27% (p=0.008 n=5+5) Encoder/16-8 209MB/s ± 0% 210MB/s ± 0% +0.42% (p=0.008 n=5+5) Encoder/256-8 720MB/s ± 0% 882MB/s ± 0% +22.53% (p=0.008 n=5+5) Encoder/4K-8 1.01GB/s ± 0% 1.11GB/s ± 0% +9.47% (p=0.008 n=5+5) Encoder/32K-8 962MB/s ± 0% 1121MB/s ± 0% +16.58% (p=0.008 n=5+5) Decoder/16-8 78.1MB/s ± 0% 77.1MB/s ± 1% -1.25% (p=0.008 n=5+5) Decoder/256-8 977MB/s ± 0% 1040MB/s ± 1% +6.45% (p=0.008 n=5+5) Decoder/4K-8 2.76GB/s ± 0% 3.65GB/s ± 0% +32.39% (p=0.008 n=5+5) Decoder/32K-8 2.98GB/s ± 0% 4.06GB/s ± 1% +36.31% (p=0.008 n=5+5) name old alloc/op new alloc/op delta EncodeTo/16-8 0.00B 0.00B ~ (all equal) EncodeTo/256-8 0.00B 0.00B ~ (all equal) EncodeTo/4K-8 0.00B 0.00B ~ (all equal) EncodeTo/32K-8 0.00B 0.00B ~ (all equal) DecodeTo/16-8 0.00B 0.00B ~ (all equal) DecodeTo/256-8 0.00B 0.00B ~ (all equal) DecodeTo/4K-8 0.00B 0.00B ~ (all equal) DecodeTo/32K-8 0.00B 0.00B ~ (all equal) Encoder/16-8 24.0B ± 0% 24.0B ± 0% ~ (all equal) Encoder/256-8 472B ± 0% 24B ± 0% -94.92% (p=0.008 n=5+5) Encoder/4K-8 24.0B ± 0% 24.0B ± 0% ~ (all equal) Encoder/32K-8 41.0kB ± 0% 0.0kB ± 0% -99.94% (p=0.008 n=5+5) Decoder/16-8 1.39kB ± 0% 1.39kB ± 0% ~ (all equal) Decoder/256-8 1.39kB ± 0% 1.39kB ± 0% ~ (all equal) Decoder/4K-8 4.98kB ± 0% 4.98kB ± 0% ~ (all equal) Decoder/32K-8 41.1kB ± 0% 41.1kB ± 0% ~ (all equal) name old allocs/op new allocs/op delta EncodeTo/16-8 0.00 0.00 ~ (all equal) EncodeTo/256-8 0.00 0.00 ~ (all equal) EncodeTo/4K-8 0.00 0.00 ~ (all equal) EncodeTo/32K-8 0.00 0.00 ~ (all equal) DecodeTo/16-8 0.00 0.00 ~ (all equal) DecodeTo/256-8 0.00 0.00 ~ (all equal) DecodeTo/4K-8 0.00 0.00 ~ (all equal) DecodeTo/32K-8 0.00 0.00 ~ (all equal) Encoder/16-8 1.00 ± 0% 1.00 ± 0% ~ (all equal) Encoder/256-8 2.00 ± 0% 1.00 ± 0% -50.00% (p=0.008 n=5+5) Encoder/4K-8 1.00 ± 0% 1.00 ± 0% ~ (all equal) Encoder/32K-8 2.00 ± 0% 1.00 ± 0% -50.00% (p=0.008 n=5+5) Decoder/16-8 3.00 ± 0% 3.00 ± 0% ~ (all equal) Decoder/256-8 3.00 ± 0% 3.00 ± 0% ~ (all equal) Decoder/4K-8 3.00 ± 0% 3.00 ± 0% ~ (all equal) Decoder/32K-8 3.00 ± 0% 3.00 ± 0% ~ (all equal)
go-base16384
base16384 interface of golang
Usage
Quick start
package main
import (
"fmt"
b14 "github.com/fumiama/go-base16384"
)
func main() {
str := b14.EncodeString("1234567")
fmt.Println(str, b14.DecodeString(str))
}
API
func Encode(b []byte) (encd []byte)
func EncodeLen(in int) (out int)
func EncodeTo(b, encd []byte) error
func EncodeToString(b []byte) string
func EncodeFromString(s string) []byte
func EncodeString(s string) string
func DecodeLen(in, offset int) (out int)
func Decode(b []byte) (decd []byte)
func DecodeTo(b []byte, decd []byte) error
func DecodeToString(d []byte) string
func DecodeFromString(s string) []byte
func DecodeString(s string) string
Stream API
package main
import (
"bytes"
"crypto/rand"
"io"
b14 "github.com/fumiama/go-base16384"
)
func main() {
buf := make([]byte, 1024*1024+1)
_, err := rand.Read(buf)
if err != nil {
panic(err)
}
w := bytes.NewBuffer(make([]byte, 0, 1024*1024+1))
e := b14.NewEncoder(bytes.NewReader(buf))
_, err = io.Copy(w, e)
if err != nil {
panic(err)
}
w2 := bytes.NewBuffer(make([]byte, 0, 1024*1024+1))
d := b14.NewDecoder(bytes.NewReader(w.Bytes()))
_, err = io.Copy(w2, d)
if err != nil {
panic(err)
}
if !bytes.Equal(buf, w2.Bytes()) {
panic("fail!")
}
}
Languages
Go
53.1%
Assembly
34.3%
C
12.6%