mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 03:32:33 +08:00
Chore: benchmark explanation
This commit is contained in:
parent
507ba16065
commit
b3a293ab07
|
@ -47,3 +47,13 @@ Prerequisite
|
|||
```
|
||||
$ go test -p 1 -v
|
||||
```
|
||||
|
||||
benchmark (Linux)
|
||||
|
||||
> Cannot represent the throughput of the protocol on your machine
|
||||
> but you can compare the corresponding throughput of the protocol on clash
|
||||
> (change chunkSize to measure the maximum throughput of clash on your machine)
|
||||
|
||||
```
|
||||
$ go test -benchmem -run=^$ -bench .
|
||||
```
|
||||
|
|
|
@ -636,7 +636,8 @@ func benchmarkProxy(b *testing.B, proxy C.ProxyAdapter) {
|
|||
c.Close()
|
||||
}()
|
||||
|
||||
chunk := make([]byte, 1024)
|
||||
chunkSize := int64(16 * 1024)
|
||||
chunk := make([]byte, chunkSize)
|
||||
conn, err := proxy.DialContext(context.Background(), &C.Metadata{
|
||||
Host: localIP.String(),
|
||||
DstPort: "10001",
|
||||
|
@ -646,7 +647,7 @@ func benchmarkProxy(b *testing.B, proxy C.ProxyAdapter) {
|
|||
assert.FailNow(b, err.Error())
|
||||
}
|
||||
|
||||
b.SetBytes(1024)
|
||||
b.SetBytes(chunkSize)
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
if _, err := conn.Write(chunk); err != nil {
|
||||
|
|
Loading…
Reference in New Issue
Block a user