Skip to content

Improve CPU performance by using json-iterator instead of encoding/json#12

Open
debnath wants to merge 3 commits into
nvellon:masterfrom
debnath:master
Open

Improve CPU performance by using json-iterator instead of encoding/json#12
debnath wants to merge 3 commits into
nvellon:masterfrom
debnath:master

Conversation

@debnath

@debnath debnath commented Apr 8, 2019

Copy link
Copy Markdown

Hi, not sure if you wanted to add in vendor'd dependencies into your package, but figured I'll open a PR and see if you wanted the change.

I noticed while running pprof on my production application that the json Unmarshalling of package nvellon/hal was in the top5 CPU consuming functions. So I swapped out encoding/json with json-iterator on my fork and noticed an immediate improvement in both CPU consumption as well as latency.

I also noticed the unit tests fail in go1.12, so I made some minor changes to the tests.

@coveralls

coveralls commented Apr 8, 2019

Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 86.503% when pulling dbf01ee on debnath:master into d5526db on nvellon:master.

@debnath

debnath commented Apr 8, 2019

Copy link
Copy Markdown
Author

Looks like the travisci check has failed due to not being to import in package context in go1.4. context was not included until go1.9, so this makes sense.

Please go ahead and delete this PR if you wanted to retain go1.4 compatibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants