Closed jgoodall closed 9 years ago
Pretty much all basic types and structs will hit the 2-3x performance gain. I'm always looking for real world examples to add to the built in benchmarks, so if you have a good example structure you can share that would be great.
Known areas of weakness:
Marshal:
strconv.AppendFloat
to using a byte.Buffer
.Unmarshal:
Also, it should be possible to string together multiple buf.WriteString:
buf.WriteString(`{`)
buf.WriteString(`"message":`)
Should be able to become:
buf.WriteString(`{"message":`)
Nothing big, but it avoids: 2 function calls (I assume copy() is inlined), 1 buffer size check (in buf.grow), one re-slice (grow), 1 copy operation.
@klauspost To do that consistently, I think I'd have to move to more of an AST-style representation and then have an optimization pass to merge WriteString
calls.
I think we have coverered the issues now in the documentation, so I will close this issue.
The Readme notes that speed improvements will "depending on the structure". What data types will see the most or least improvements?