mirror of
https://github.com/LBRYFoundation/lbcd.git
synced 2025-08-23 17:47:24 +00:00
Optimize writeVarString.
Before: BenchmarkWriteVarStr4 1000000 1114 ns/op BenchmarkWriteVarStr10 1000000 1352 ns/op After: BenchmarkWriteVarStr4 5000000 291 ns/op BenchmarkWriteVarStr10 10000000 248 ns/op This is part ef the ongoing effort to optimize serialization as noted in conformal/btcd#27.
This commit is contained in:
parent
fa8f666e8c
commit
8a1828a2d6
1 changed files with 1 additions and 1 deletions
|
@ -181,7 +181,7 @@ func writeVarString(w io.Writer, pver uint32, str string) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = writeElement(w, []byte(str))
|
_, err = w.Write([]byte(str))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue