emmansun / base64

Base64 with SIMD acceleration
https://godoc.org/github.com/emmansun/base64
BSD 3-Clause "New" or "Revised" License
5 stars 0 forks source link

arm64 optimization #20

Closed emmansun closed 1 month ago

emmansun commented 1 month ago
emmansun commented 1 month ago

相对来说还是有提高的:

cpu: Intel(R) Core(TM) i5-9500 CPU @ 3.00GHz
BenchmarkEncode
BenchmarkEncode/size-16
BenchmarkEncode/size-16-6
76836388            16.59 ns/op  964.22 MB/s           0 B/op          0 allocs/op
BenchmarkEncode/size-32
BenchmarkEncode/size-32-6
50011460            20.78 ns/op 1539.68 MB/s           0 B/op          0 allocs/op
BenchmarkEncode/size-64
BenchmarkEncode/size-64-6
43879375            23.39 ns/op 2735.85 MB/s           0 B/op          0 allocs/op

BenchmarkDecode
BenchmarkDecode/size-24
BenchmarkDecode/size-24-6
64678520            17.71 ns/op 1355.51 MB/s           0 B/op          0 allocs/op
BenchmarkDecode/size-40
BenchmarkDecode/size-40-6
62636364            17.78 ns/op 2249.46 MB/s           0 B/op          0 allocs/op
BenchmarkDecode/size-56
BenchmarkDecode/size-56-6
55863840            19.37 ns/op 2891.07 MB/s           0 B/op          0 allocs/op

普通实现:

cpu: Intel(R) Core(TM) i5-9500 CPU @ 3.00GHz
BenchmarkEncode
BenchmarkEncode/size-16
BenchmarkEncode/size-16-6
64910565            17.95 ns/op  891.44 MB/s           0 B/op          0 allocs/op
BenchmarkEncode/size-32
BenchmarkEncode/size-32-6
34061298            32.49 ns/op  984.87 MB/s           0 B/op          0 allocs/op
BenchmarkEncode/size-64
BenchmarkEncode/size-64-6
19037526            60.55 ns/op 1057.00 MB/s           0 B/op          0 allocs/op

BenchmarkDecode
BenchmarkDecode/size-24
BenchmarkDecode/size-24-6
51205898            22.09 ns/op 1086.67 MB/s           0 B/op          0 allocs/op
BenchmarkDecode/size-40
BenchmarkDecode/size-40-6
33220291            33.59 ns/op 1190.92 MB/s           0 B/op          0 allocs/op
BenchmarkDecode/size-56
BenchmarkDecode/size-56-6
25079103            43.69 ns/op 1281.75 MB/s           0 B/op          0 allocs/op
emmansun commented 1 month ago

v0.6.0