Skip to content

encoding/json: remove comment about performance of scanner.step #37386

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

Closed
wants to merge 1 commit into from

Conversation

codesoap
Copy link
Contributor

@codesoap codesoap commented Feb 23, 2020

In an experiment I could not reproduce the 10% performance loss when
using an integer constant for scanner.step. Instead the performance
seemed to be about the same.

The experiment can be seen here: codesoap@c7b685b

Less allocations are made in my experimental version, but the difference
is probably insignificant and depends on the used hardware. I'd be
interested to see the results on other systems.

I tested on a ThinkPad T450:

  • CPU: Intel(R) Core(TM) i5-5300U CPU @ 2.30GHz
  • 12GiB Ram DDR3
  • OS: OpenBSD 6.6 (amd64)

I know this PR is somewhat pedantic, but I think the comment could
potentially keep people from trying to optimize this piece of code and
thus hinder development.

In an experiment I could not reproduce the 10% performance loss when
using an integer constant for scanner.step. Instead the performance
seemed to be about the same or slightly better than before.
@googlebot googlebot added the cla: yes Used by googlebot to label PRs as having a valid CLA. The text of this label should not change. label Feb 23, 2020
@gopherbot
Copy link
Contributor

This PR (HEAD: fc6a49f) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/220582 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Contributor

Message from Ian Lance Taylor:

Patch Set 1:

Please update the CL description to describe the machine you tested on. Thanks.


Please don’t reply on this GitHub thread. Visit golang.org/cl/220582.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Richard Ulmer:

Patch Set 2:

Patch Set 1:

Please update the CL description to describe the machine you tested on. Thanks.

Done. Let me know if you need more info.


Please don’t reply on this GitHub thread. Visit golang.org/cl/220582.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Richard Ulmer:

Patch Set 2:

I just learned that I have to use go test -count <x> in order to get better results in benchstat. Thanks Daniel Martí for #23471 !

I feel a bit stupid now, but as you can see in the updated benchmark (see CL's description), the slowdown is just about 1% instead of 10% on my machine.


Please don’t reply on this GitHub thread. Visit golang.org/cl/220582.
After addressing review feedback, remember to publish your drafts!

@codesoap codesoap closed this Feb 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Used by googlebot to label PRs as having a valid CLA. The text of this label should not change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants