Optimize readVarString.
Before: BenchmarkReadVarStr4 1000000 1698 ns/op BenchmarkReadVarStr10 1000000 1812 ns/op After: BenchmarkReadVarStr4 2000000 853 ns/op BenchmarkReadVarStr10 5000000 712 ns/op This is part ef the ongoing effort to optimize serialization as noted in conformal/btcd#27.
This commit is contained in:
parent
b830e2ddf3
commit
4002051a22
1 changed files with 1 additions and 1 deletions
|
@ -167,7 +167,7 @@ func readVarString(r io.Reader, pver uint32) (string, error) {
|
|||
}
|
||||
|
||||
buf := make([]byte, count)
|
||||
err = readElement(r, buf)
|
||||
_, err = io.ReadFull(r, buf)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue