• Linux 测试环境
    • 并行测试
    • 非并行测试
  • Mac 测试环境
    • 并行测试
    • 非并行测试

    Linux 测试环境

    • go1.6.2 linux/amd64
    • Ubuntu 16.04 amd64
    • 虚拟机
    • 2 个处理器核心
    • 2 GB 内存

      并行测试

    1. BenchmarkParallelHprose2-2 200000 9239 ns/op 789 B/op 25 allocs/op
    2. BenchmarkParallelHprose2Unix-2 200000 6400 ns/op 789 B/op 25 allocs/op
    3. BenchmarkParallelHprose-2 100000 12541 ns/op 4405 B/op 63 allocs/op
    4. BenchmarkParallelHproseUnix-2 200000 9907 ns/op 4405 B/op 63 allocs/op
    5. BenchmarkParallelGobRPC-2 100000 17895 ns/op 360 B/op 12 allocs/op
    6. BenchmarkParallelGobRPCUnix-2 100000 12373 ns/op 360 B/op 12 allocs/op
    7. BenchmarkParallelJSONRPC-2 100000 21693 ns/op 1218 B/op 30 allocs/op
    8. BenchmarkParallelJSONRPCUnix-2 100000 15956 ns/op 1218 B/op 30 allocs/op

    非并行测试

    1. BenchmarkHprose2-2 100000 14252 ns/op 789 B/op 25 allocs/op
    2. BenchmarkHprose2Unix-2 200000 9885 ns/op 789 B/op 25 allocs/op
    3. BenchmarkHprose-2 100000 18234 ns/op 4405 B/op 63 allocs/op
    4. BenchmarkHproseUnix-2 100000 13060 ns/op 4405 B/op 63 allocs/op
    5. BenchmarkGobRPC-2 100000 20534 ns/op 360 B/op 12 allocs/op
    6. BenchmarkGobRPCUnix-2 100000 14351 ns/op 360 B/op 12 allocs/op
    7. BenchmarkJSONRPC-2 50000 24350 ns/op 1224 B/op 30 allocs/op
    8. BenchmarkJSONRPCUnix-2 100000 18321 ns/op 1224 B/op 30 allocs/op

    Mac 测试环境

    • go1.7.1 darwin/amd64
    • macOS Sierra
    • iMac (Retina 5K, 27-inch, Late 2015)
    • 处理器 4GHz Intel Core i7
    • 内存 32 GB 1867 MHz DDR3

      并行测试

    1. BenchmarkParallelHprose2-8 200000 11080 ns/op 791 B/op 25 allocs/op
    2. BenchmarkParallelHprose2Unix-8 300000 5238 ns/op 791 B/op 25 allocs/op
    3. BenchmarkParallelHprose-8 200000 11243 ns/op 4405 B/op 63 allocs/op
    4. BenchmarkParallelHproseUnix-8 300000 5702 ns/op 4405 B/op 63 allocs/op
    5. BenchmarkParallelGobRPC-8 100000 16815 ns/op 360 B/op 12 allocs/op
    6. BenchmarkParallelGobRPCUnix-8 200000 6707 ns/op 360 B/op 12 allocs/op
    7. BenchmarkParallelJSONRPC-8 100000 17649 ns/op 1216 B/op 30 allocs/op
    8. BenchmarkParallelJSONRPCUnix-8 200000 7809 ns/op 1216 B/op 30 allocs/op

    非并行测试

    1. BenchmarkHprose2-8 50000 34164 ns/op 791 B/op 25 allocs/op
    2. BenchmarkHprose2Unix-8 100000 12012 ns/op 791 B/op 25 allocs/op
    3. BenchmarkHprose-8 50000 35938 ns/op 4405 B/op 63 allocs/op
    4. BenchmarkHproseUnix-8 100000 13122 ns/op 4405 B/op 63 allocs/op
    5. BenchmarkGobRPC-8 30000 47610 ns/op 360 B/op 12 allocs/op
    6. BenchmarkGobRPCUnix-8 50000 24507 ns/op 360 B/op 12 allocs/op
    7. BenchmarkJSONRPC-8 30000 51826 ns/op 1224 B/op 30 allocs/op
    8. BenchmarkJSONRPCUnix-8 50000 29195 ns/op 1224 B/op 30 allocs/op

    • Hprose2 表示 Hprose 2.0
    • Hprose 表示 Hprose 1.x
    • GobRPC 表示 go 内置的 net/rpc
    • JSONRPC 表示 go 内置的 net/rpc/jsonrpc
    • 带 Unix 表示 Unix Socket 通讯,不带 Unix 表示 TCP 通讯

    原文:

    https://github.com/hprose/hprose-golang/wiki/%E6%80%A7%E8%83%BD%E6%B5%8B%E8%AF%95