mirror of
https://github.com/fumiama/go-base16384.git
synced 2026-06-11 21:50:42 +08:00
add amd64 asm
name old time/op new time/op delta EncodeTo/16-8 45.5ns ± 1% 35.9ns ± 1% -21.01% (p=0.008 n=5+5) EncodeTo/256-8 241ns ± 1% 170ns ± 1% -29.64% (p=0.008 n=5+5) EncodeTo/4K-8 2.90µs ± 0% 1.70µs ± 0% -41.60% (p=0.008 n=5+5) EncodeTo/32K-8 23.5µs ± 2% 13.6µs ± 2% -42.20% (p=0.008 n=5+5) DecodeTo/16-8 20.2ns ± 0% 10.3ns ± 2% -48.92% (p=0.008 n=5+5) DecodeTo/256-8 141ns ± 1% 71ns ± 0% -49.55% (p=0.008 n=5+5) DecodeTo/4K-8 2.03µs ± 1% 0.94µs ± 0% -53.82% (p=0.008 n=5+5) DecodeTo/32K-8 16.1µs ± 0% 7.5µs ± 0% -53.22% (p=0.008 n=5+5) name old speed new speed delta EncodeTo/16-8 352MB/s ± 1% 445MB/s ± 1% +26.59% (p=0.008 n=5+5) EncodeTo/256-8 1.06GB/s ± 1% 1.51GB/s ± 1% +42.13% (p=0.008 n=5+5) EncodeTo/4K-8 1.41GB/s ± 0% 2.42GB/s ± 0% +71.24% (p=0.008 n=5+5) EncodeTo/32K-8 1.40GB/s ± 2% 2.42GB/s ± 2% +73.01% (p=0.008 n=5+5) DecodeTo/16-8 1.09GB/s ± 0% 2.14GB/s ± 2% +95.84% (p=0.008 n=5+5) DecodeTo/256-8 2.10GB/s ± 1% 4.16GB/s ± 0% +98.21% (p=0.008 n=5+5) DecodeTo/4K-8 2.30GB/s ± 1% 4.99GB/s ± 0% +116.55% (p=0.008 n=5+5) DecodeTo/32K-8 2.33GB/s ± 0% 4.98GB/s ± 0% +113.78% (p=0.008 n=5+5)
This commit is contained in:
@@ -2,6 +2,7 @@ package base14
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/hex"
|
||||
"io"
|
||||
"math/rand"
|
||||
"testing"
|
||||
@@ -10,10 +11,21 @@ import (
|
||||
)
|
||||
|
||||
func TestBase14(t *testing.T) {
|
||||
teststr := "一个测试293大大的啊定位为恶的我284的我……#@%@%@"
|
||||
es := EncodeString(teststr)
|
||||
assert.Equal(t, "蜮嘎惢磦筢貊豔耹嫹桊涖犧蟦癎摖壥禦籋萷犸粹瘛榞梄螢圓因苧璡屨灇炀瞸瘊暍严帉戀㴃", es)
|
||||
assert.Equal(t, teststr, DecodeString(es))
|
||||
assert.Equal(t, "蜮嘎惢磦筢貊豔耹嫹桊涖犧蟦癎摖壥禦籋萷犸粹瘛榞梄螢圓因苧璡屨灇炀瞸瘊暍严帉戀㴃", EncodeString("一个测试293大大的啊定位为恶的我284的我……#@%@%@"))
|
||||
assert.Equal(t, "婀㴁", EncodeString("1"))
|
||||
assert.Equal(t, "婌渀㴂", EncodeString("12"))
|
||||
assert.Equal(t, "婌焰㴃", EncodeString("123"))
|
||||
assert.Equal(t, "婌焳帀㴄", EncodeString("1234"))
|
||||
assert.Equal(t, "婌焳廔㴅", EncodeString("12345"))
|
||||
assert.Equal(t, "婌焳廔萀㴆", EncodeString("123456"))
|
||||
assert.Equal(t, "婌焳廔萷", EncodeString("1234567"))
|
||||
assert.Equal(t, "婌焳廔萷尀㴁", EncodeString("12345678"))
|
||||
buf := make([]byte, 4096)
|
||||
for i := 1; i < 4096; i++ {
|
||||
rand.Read(buf[:i])
|
||||
out := Decode(Encode(buf[:i]))
|
||||
assert.Equal(t, hex.EncodeToString(buf[:i]), hex.EncodeToString(out))
|
||||
}
|
||||
}
|
||||
|
||||
func TestEncoder(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user