1
0
mirror of https://github.com/fumiama/go-base16384.git synced 2026-06-05 00:32:52 +08:00
Files
go-base16384/base14_arm64.go
源文雨 cdc9c6322a arm64: 优化流水线和内存分配
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)
2022-12-14 10:07:47 +08:00

33 lines
598 B
Go

//go:build arm64
// +build arm64
package base14
import (
"encoding/binary"
)
//go:noescape
//go:nosplit
func _encode(offset int, b, encd []byte) (sum uint64, n int)
//go:noescape
//go:nosplit
func _decode(offset, outlen int, b, decd []byte)
func encode(offset, outlen int, b, encd []byte) {
sum, n := _encode(offset, b, encd)
if offset == 0 {
return
}
var tmp [4]byte
binary.LittleEndian.PutUint32(tmp[:], uint32(sum))
copy(encd[n:], tmp[:])
encd[outlen-2] = '='
encd[outlen-1] = byte(offset)
}
func decode(offset, outlen int, b, decd []byte) {
_decode(offset, outlen, b, decd)
}