Add optimized StructEnd operation to vm

This commit is contained in:
Masaaki Goshima 2020-12-29 23:17:39 +09:00
parent 1f5e0cb5fd
commit 17f7434e93
2 changed files with 2216 additions and 5 deletions

View File

@ -312,6 +312,17 @@ func encodeIndentComma(b []byte) []byte {
return append(b, ',', '\n')
}
func appendStructEnd(b []byte) []byte {
return append(b, '}', ',')
}
func (e *Encoder) appendStructEndIndent(b []byte, indent int) []byte {
b = append(b, '\n')
b = append(b, e.prefix...)
b = append(b, bytes.Repeat(e.indentStr, indent)...)
return append(b, '}', ',', '\n')
}
func encodeByteSlice(b []byte, src []byte) []byte {
encodedLen := base64.StdEncoding.EncodedLen(len(src))
b = append(b, '"')

File diff suppressed because it is too large Load Diff