• Daniel Martí's avatar
    encoding/json: simplify some pieces of the encoder · 9d1540b7
    Daniel Martí authored
    Some WriteByte('\\') calls can be deduplicated.
    
    fillField is used in two occasions, but it is unnecessary when adding
    fields to the "next" stack, as those aren't used for the final encoding.
    Inline the func with its only remaining call.
    
    Finally, unindent a default-if block.
    
    The performance of the encoder is unaffected:
    
    name           old time/op    new time/op    delta
    CodeEncoder-4    6.65ms ± 1%    6.65ms ± 0%   ~     (p=0.662 n=6+5)
    
    Change-Id: Ie55baeab89abad9b9f13e9f6ca886a670c30dba9
    Reviewed-on: https://go-review.googlesource.com/122461
    Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    9d1540b7
Name
Last commit
Last update
..
testdata Loading commit data...
bench_test.go Loading commit data...
decode.go Loading commit data...
decode_test.go Loading commit data...
encode.go Loading commit data...
encode_test.go Loading commit data...
example_marshaling_test.go Loading commit data...
example_test.go Loading commit data...
fold.go Loading commit data...
fold_test.go Loading commit data...
indent.go Loading commit data...
number_test.go Loading commit data...
scanner.go Loading commit data...
scanner_test.go Loading commit data...
stream.go Loading commit data...
stream_test.go Loading commit data...
tables.go Loading commit data...
tagkey_test.go Loading commit data...
tags.go Loading commit data...
tags_test.go Loading commit data...