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

syntax: replace if-else chains with expr switch stmt #254

Merged
merged 1 commit into from
Jun 23, 2018
Merged

syntax: replace if-else chains with expr switch stmt #254

merged 1 commit into from
Jun 23, 2018

Conversation

quasilyte
Copy link
Contributor

Usually this form is considered more idiomatic.
I've left if-else chains with init statements untouched
to less obvious changes.

Found with elseif check from go-critic linter.

Usually this form is considered more idiomatic.
I've left if-else chains with init statements untouched
to less obvious changes.

Found with `elseif` check from go-critic linter.
Copy link
Owner

@mvdan mvdan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check that the benchmarks don't get affected by this. Especially the parser, as touching the lexer code can lead to noticeable slowdowns.

@quasilyte
Copy link
Contributor Author

Sure thing.

name     old time/op  new time/op  delta
Parse-8  42.4µs ± 1%  42.2µs ± 1%  -0.57%  (p=0.011 n=9+9)
Print-8  10.3µs ± 0%  10.2µs ± 0%    ~     (p=0.150 n=9+10)

Seems there is hardly any changes at all (-0.57% is a noise here)

@mvdan
Copy link
Owner

mvdan commented Jun 23, 2018

Great, thanks. I presumed so, but you never know.

@mvdan mvdan merged commit ca7561f into mvdan:master Jun 23, 2018
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