Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encoding/json: reduce allocations by Decoder for \uXXXX #20567

Closed
schmichael opened this issue Jun 3, 2017 · 1 comment

Comments

Projects
None yet
4 participants
@schmichael
Copy link
Contributor

commented Jun 3, 2017

What version of Go are you using (go version)?

go version go1.8.3 linux/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/schmichael/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build241021771=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

What did you do?

Looked at how json.Decoder parsed Unicode escape sequences.

What did you expect to see?

Not strconv

What did you see instead?

strconv

I'm working on a patch to decoder.go:getu4() to convert Unicode escape sequences to their underlying rune without round tripping the data through a string to use strconv. Should save an allocation.

@dsnet dsnet added the Performance label Jun 3, 2017

@gopherbot

This comment has been minimized.

Copy link

commented Jun 3, 2017

CL https://golang.org/cl/44738 mentions this issue.

@ianlancetaylor ianlancetaylor added this to the Go1.10 milestone Jun 4, 2017

@mikioh mikioh changed the title json: reduce allocations by Decoder for \uXXXX encoding/json: reduce allocations by Decoder for \uXXXX Aug 3, 2017

@gopherbot gopherbot closed this in 7eb7f8f Nov 22, 2017

@golang golang locked and limited conversation to collaborators Nov 22, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.