Created
July 27, 2019 05:33
-
-
Save quiye/3eeb58f6d1e0f9285a334981983b8e1e to your computer and use it in GitHub Desktop.
msgpackの練習
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"math" | |
"github.com/vmihailenco/msgpack" | |
) | |
func main() { | |
for i := 0; i < 10000; i = int(float32(i+1) * 1.7) { | |
var b string | |
for j := 0; j < i; j++ { | |
b = b + "a" | |
} | |
f(b) | |
} | |
} | |
func f(s string) { | |
b, _ := msgpack.Marshal(s) | |
log.Printf("%#v, %d, %d", b[:int32(math.Min(10, float64(len(b))))], len(b), len(s)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/msgpack/msgpack/blob/master/spec.md