forked from smallnest/gosercomp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
261 additions
and
2 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package gosercomp | ||
package main | ||
|
||
import ( | ||
"github.com/golang/protobuf/proto" | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package gosercomp | ||
package main | ||
|
||
import ( | ||
"bytes" | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
-- found gnuplot command: /usr/local/bin/gnuplot | ||
goos: darwin | ||
goarch: amd64 | ||
pkg: github.com/smallnest/gosercomp | ||
BenchmarkMarshalByJson-4 1850058 647 ns/op 65.0 marshaledBytes | ||
BenchmarkMarshalByXml-4 308764 3997 ns/op 137 marshaledBytes | ||
BenchmarkMarshalByMsgp-4 10046798 140 ns/op 47.0 marshaledBytes | ||
BenchmarkMarshalByProtoBuf-4 5250182 256 ns/op 36.0 marshaledBytes | ||
BenchmarkMarshalByGogoProtoBuf-4 4894754 257 ns/op 36.0 marshaledBytes | ||
BenchmarkMarshalByThrift-4 1995572 566 ns/op 63.0 marshaledBytes | ||
BenchmarkMarshalByAvro-4 3410665 346 ns/op 32.0 marshaledBytes | ||
BenchmarkMarshalByGencode-4 24767253 51.2 ns/op 34.0 marshaledBytes | ||
BenchmarkMarshalByUgorjiCodecAndCbor-4 1717364 682 ns/op 47.0 marshaledBytes | ||
BenchmarkMarshalByUgorjiCodecAndMsgp-4 1858545 726 ns/op 47.0 marshaledBytes | ||
BenchmarkMarshalByUgorjiCodecAndBinc-4 1894346 583 ns/op 47.0 marshaledBytes | ||
BenchmarkMarshalByUgorjiCodecAndJson-4 1609161 717 ns/op 65.0 marshaledBytes | ||
BenchmarkMarshalByEasyjson-4 4180846 283 ns/op 65.0 marshaledBytes | ||
BenchmarkMarshalByFfjson-4 1293396 946 ns/op 65.0 marshaledBytes | ||
BenchmarkMarshalByJsoniter-4 2346495 511 ns/op 65.0 marshaledBytes | ||
BenchmarkMarshalByGoMemdump-4 272938 5222 ns/op 200 marshaledBytes | ||
BenchmarkMarshalByColfer-4 34834042 39.2 ns/op 35.0 marshaledBytes | ||
BenchmarkMarshalByZebrapack-4 5803422 307 ns/op 109 marshaledBytes | ||
BenchmarkMarshalByGotiny-4 2643406 422 ns/op 32.0 marshaledBytes | ||
BenchmarkMarshalByHprose-4 3216709 372 ns/op 49.0 marshaledBytes | ||
BenchmarkMarshalBySereal-4 501252 2164 ns/op 76.0 marshaledBytes | ||
BenchmarkMarshalByMsgpackV2-4 890499 1371 ns/op 47.0 marshaledBytes | ||
BenchmarkMarshalByRlp-4 2498214 487 ns/op 32.0 marshaledBytes | ||
BenchmarkMarshalBySegmentioJSON-4 1925108 584 ns/op 65.0 marshaledBytes | ||
PASS | ||
ok github.com/smallnest/gosercomp 40.981s |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Json,647 | ||
Xml,3997 | ||
Msgp,140 | ||
ProtoBuf,256 | ||
GogoProtoBuf,257 | ||
Thrift,566 | ||
Avro,346 | ||
Gencode,0 | ||
UgorjiCodecAndCbor,682 | ||
UgorjiCodecAndMsgp,726 | ||
UgorjiCodecAndBinc,583 | ||
UgorjiCodecAndJson,717 | ||
Easyjson,283 | ||
Ffjson,946 | ||
Jsoniter,511 | ||
GoMemdump,5222 | ||
Colfer,0 | ||
Zebrapack,307 | ||
Gotiny,422 | ||
Hprose,372 | ||
Sereal,2164 | ||
MsgpackV2,1371 | ||
Rlp,487 | ||
SegmentioJSON,584 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Json,65 | ||
Xml,137 | ||
Msgp,47 | ||
ProtoBuf,36 | ||
GogoProtoBuf,36 | ||
Thrift,63 | ||
Avro,32 | ||
Gencode,34 | ||
UgorjiCodecAndCbor,47 | ||
UgorjiCodecAndMsgp,47 | ||
UgorjiCodecAndBinc,47 | ||
UgorjiCodecAndJson,65 | ||
Easyjson,65 | ||
Ffjson,65 | ||
Jsoniter,65 | ||
GoMemdump,200 | ||
Colfer,35 | ||
Zebrapack,109 | ||
Gotiny,32 | ||
Hprose,49 | ||
Sereal,76 | ||
MsgpackV2,47 | ||
Rlp,32 | ||
SegmentioJSON,65 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
package main | ||
|
||
import ( | ||
"bufio" | ||
"fmt" | ||
"os" | ||
"strconv" | ||
"strings" | ||
) | ||
|
||
func main() { | ||
libs, tooks, marshaledBytes := readMarshalLog() | ||
tookFile, _ := os.OpenFile("marshal_took.csv", os.O_CREATE|os.O_RDWR, 0777) | ||
marshaledBytesFile, _ := os.OpenFile("marshaledBytes.csv", os.O_CREATE|os.O_RDWR, 0777) | ||
defer tookFile.Close() | ||
defer marshaledBytesFile.Close() | ||
|
||
for i, name := range libs { | ||
tookFile.WriteString(fmt.Sprintf("%s,%d\n", name, tooks[i])) | ||
marshaledBytesFile.WriteString(fmt.Sprintf("%s,%d\n", name, marshaledBytes[i])) | ||
} | ||
|
||
libs, tooks = readUnmarshalLog() | ||
tookFile2, _ := os.OpenFile("unmarshal_took.csv", os.O_CREATE|os.O_RDWR, 0777) | ||
defer tookFile2.Close() | ||
|
||
for i, name := range libs { | ||
tookFile2.WriteString(fmt.Sprintf("%s,%d\n", name, tooks[i])) | ||
} | ||
|
||
} | ||
|
||
func readMarshalLog() ([]string, []int, []int) { | ||
file, err := os.Open("marshal.log") | ||
if err != nil { | ||
panic(err) | ||
} | ||
defer file.Close() | ||
|
||
var libs []string | ||
var tooks []int | ||
var marshaledBytes []int | ||
|
||
scanner := bufio.NewScanner(file) | ||
for scanner.Scan() { | ||
line := scanner.Text() | ||
if strings.HasPrefix(line, "BenchmarkMarshalBy") { | ||
line = strings.TrimPrefix(line, "BenchmarkMarshalBy") | ||
fields := strings.Fields(line) | ||
name := fields[0] | ||
if strings.Index(name, "-") > 0 { | ||
name = name[:strings.Index(name, "-")] | ||
} | ||
libs = append(libs, name) | ||
tooks = append(tooks, s2i(fields[2])) | ||
marshaledBytes = append(marshaledBytes, int(s2f(fields[4]))) | ||
} | ||
} | ||
|
||
return libs, tooks, marshaledBytes | ||
} | ||
|
||
func readUnmarshalLog() ([]string, []int) { | ||
file, err := os.Open("unmarshal.log") | ||
if err != nil { | ||
panic(err) | ||
} | ||
defer file.Close() | ||
|
||
var libs []string | ||
var tooks []int | ||
scanner := bufio.NewScanner(file) | ||
for scanner.Scan() { | ||
line := scanner.Text() | ||
if strings.HasPrefix(line, "BenchmarkUnmarshalBy") { | ||
line = strings.TrimPrefix(line, "BenchmarkUnmarshalBy") | ||
fields := strings.Fields(line) | ||
name := fields[0] | ||
if strings.Index(name, "-") > 0 { | ||
name = name[:strings.Index(name, "-")] | ||
} | ||
libs = append(libs, name) | ||
tooks = append(tooks, s2i(fields[2])) | ||
} | ||
} | ||
|
||
return libs, tooks | ||
} | ||
|
||
func s2i(s string) int { | ||
f, _ := strconv.Atoi(s) | ||
return f | ||
} | ||
|
||
func s2f(s string) float64 { | ||
f, _ := strconv.ParseFloat(s, 64) | ||
return f | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Json,647 | ||
Xml,3997 | ||
Msgp,140 | ||
ProtoBuf,256 | ||
GogoProtoBuf,257 | ||
Thrift,566 | ||
Avro,346 | ||
Gencode,0 | ||
UgorjiCodecAndCbor,682 | ||
UgorjiCodecAndMsgp,726 | ||
UgorjiCodecAndBinc,583 | ||
UgorjiCodecAndJson,717 | ||
Easyjson,283 | ||
Ffjson,946 | ||
Jsoniter,511 | ||
GoMemdump,5222 | ||
Colfer,0 | ||
Zebrapack,307 | ||
Gotiny,422 | ||
Hprose,372 | ||
Sereal,2164 | ||
MsgpackV2,1371 | ||
Rlp,487 | ||
SegmentioJSON,584 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
-- found gnuplot command: /usr/local/bin/gnuplot | ||
goos: darwin | ||
goarch: amd64 | ||
pkg: github.com/smallnest/gosercomp | ||
BenchmarkUnmarshalByJson-4 474681 2354 ns/op | ||
BenchmarkUnmarshalByXml-4 93476 12787 ns/op | ||
BenchmarkUnmarshalByMsgp-4 5169606 201 ns/op | ||
BenchmarkUnmarshalByProtoBuf-4 2382018 507 ns/op | ||
BenchmarkUnmarshalByGogoProtoBuf-4 2882487 413 ns/op | ||
BenchmarkUnmarshalByThrift-4 1000000 1303 ns/op | ||
BenchmarkUnmarshalByAvro-4 40338 26255 ns/op | ||
BenchmarkUnmarshalByGencode-4 9043816 148 ns/op | ||
BenchmarkUnmarshalByUgorjiCodecAndCbor-4 1339586 884 ns/op | ||
BenchmarkUnmarshalByUgorjiCodecAndMsgp-4 1000000 1319 ns/op | ||
BenchmarkUnmarshalByUgorjiCodecAndBinc-4 867388 1458 ns/op | ||
BenchmarkUnmarshalByUgorjiCodecAndJson-4 1000000 1199 ns/op | ||
BenchmarkUnmarshalByEasyjson-4 1929847 707 ns/op | ||
BenchmarkUnmarshalByFfjson-4 844473 2286 ns/op | ||
BenchmarkUnmarshalByJsoniter-4 1966244 808 ns/op | ||
BenchmarkUnmarshalByGJSON-4 589440 2668 ns/op | ||
BenchmarkUnmarshalByGoMemdump-4 844342 1500 ns/op | ||
BenchmarkUnmarshalByColfer-4 5667135 247 ns/op | ||
BenchmarkUnmarshalByZebrapack-4 3494541 323 ns/op | ||
BenchmarkUnmarshalByGotiny-4 3546631 488 ns/op | ||
BenchmarkUnmarshalByHprose-4 1779548 664 ns/op | ||
BenchmarkUnmarshalBySereal-4 1714032 699 ns/op | ||
BenchmarkUnmarshalByMsgpackv2-4 1000000 1731 ns/op | ||
BenchmarkUnmarshalByRlp-4 1000000 1019 ns/op | ||
BenchmarkUnmarshalBySegmentioJSON-4 1792550 663 ns/op | ||
PASS | ||
ok github.com/smallnest/gosercomp 41.592s |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Json,2354 | ||
Xml,12787 | ||
Msgp,201 | ||
ProtoBuf,507 | ||
GogoProtoBuf,413 | ||
Thrift,1303 | ||
Avro,26255 | ||
Gencode,148 | ||
UgorjiCodecAndCbor,884 | ||
UgorjiCodecAndMsgp,1319 | ||
UgorjiCodecAndBinc,1458 | ||
UgorjiCodecAndJson,1199 | ||
Easyjson,707 | ||
Ffjson,2286 | ||
Jsoniter,808 | ||
GJSON,2668 | ||
GoMemdump,1500 | ||
Colfer,247 | ||
Zebrapack,323 | ||
Gotiny,488 | ||
Hprose,664 | ||
Sereal,699 | ||
Msgpackv2,1731 | ||
Rlp,1019 | ||
SegmentioJSON,663 |