cloudwego / netpoll

A high-performance non-blocking I/O networking framework focusing on RPC scenarios.
Apache License 2.0
4.07k stars 470 forks source link

perf: nocopy read for ReadString and ReadBinary API if possible #315

Closed joway closed 7 months ago

joway commented 9 months ago

What type of PR is this?

perf

Check the PR title.

(Optional) Translate the PR title into Chinese.

(Optional) More detailed description for this PR(en: English/zh: Chinese).

en:

before:

BenchmarkNoCopyRead-12        199310          5662 ns/op       32809 B/op         11 allocs/op

after:

BenchmarkNoCopyRead-12      17504086            80.34 ns/op       56 B/op          2 allocs/op

zh(optional):

(Optional) Which issue(s) this PR fixes:

(optional) The PR that updates user documentation: