Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sql: avoid net.Error allocation on each readTimeoutConn.Read call
This commit updates `readTimeoutConn.Read` to only call `errors.As` if the error from the Read of the wrapped `net.Conn` was non-nil. This avoids a heap allocation of a `net.Error` on each call to `readTimeoutConn.Read`, which was originally introduced in a8ae1bf. ``` name old time/op new time/op delta KV/Scan/SQL/rows=1-10 93.9µs ± 6% 94.6µs ± 7% ~ (p=0.631 n=10+10) name old alloc/op new alloc/op delta KV/Scan/SQL/rows=1-10 20.1kB ± 0% 20.1kB ± 0% ~ (p=0.197 n=10+10) name old allocs/op new allocs/op delta KV/Scan/SQL/rows=1-10 245 ± 0% 244 ± 0% -0.41% (p=0.000 n=10+10) ```
- Loading branch information