-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
encoding/json: avoid some more pointer receivers
A few encoder struct types, such as map and slice, only encapsulate other prepared encoder funcs. Using pointer receivers has no advantage, and makes calling these methods slightly more expensive. Not a huge performance win, but certainly an easy one. The struct types used in the benchmark below contain one slice field and one pointer field. name old time/op new time/op delta CodeEncoder-4 5.48ms ± 0% 5.39ms ± 0% -1.66% (p=0.010 n=6+4) name old speed new speed delta CodeEncoder-4 354MB/s ± 0% 360MB/s ± 0% +1.69% (p=0.010 n=6+4) Updates #5683. Change-Id: I9f78dbe07fcc6fbf19a6d96c22f5d6970db9eca4 Reviewed-on: https://go-review.googlesource.com/131400 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
- Loading branch information
Showing
1 changed file
with
10 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters