-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Use of reflect.TypeOf slows down Go execution by 33% #2278
Comments
Sample Before:
Sample After:
|
@millergarym @pboyer Care to take a look? Thanks. |
Good find! I'll try and take a look at this soon.
…On Mon, Apr 23, 2018, 10:55 PM Yang Yang ***@***.***> wrote:
@millergarym <https://github.com/millergarym> @pboyer
<https://github.com/pboyer> Care to take a look? Thanks.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2278 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AA37eT15RH77LMb2mJ6qWfDtNQh6qMEYks5trpQLgaJpZM4TeKd1>
.
|
Cool. @pboyer I setup up a regression test environment when last doing performance work. It might be of interest. see https://github.com/wxio/antlr4-jenkins/ @davesisson any chance of getting an example grammar and input. Benchmarking can be quite context dependant. Also, imo its nicer to have a really problem that someone cares about than a substituent. |
I agree that a real problem would be useful. Unfortunately the grammar and
input i have are all internal (but have no fear that it's complex :) ). If
I had to choose a suitable replacement I'd choose a fully featured language
like in the antlr grammars collection. It's bigger than the C grammar so
how about Java 9?
https://github.com/antlr/grammars-v4/blob/master/java9/Java9.g4
…On Tue, Apr 24, 2018 at 10:30 PM Gary Miller ***@***.***> wrote:
Cool.
@pboyer <https://github.com/pboyer> I setup up a regression test
environment when last doing performance work. It might be of interest. see
https://github.com/wxio/antlr4-jenkins/
@davesisson <https://github.com/davesisson> any chance of getting an
example grammar and input. Benchmarking can be quite context dependant.
Also, imo its nicer to have a really problem that someone cares about than
a substituent.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2278 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ALUC_ShEgDAmLbtJksVVwuwcv9wsl1MLks5tsAoEgaJpZM4TeKd1>
.
|
Any news, please? In my case, removing reflection from the parser does make it faster, but not by much (25.60s -> 24.59s, internal project). Still noticeably slower than the Java version. I modified |
It's quite a good improvement (4%).
Yes, please do it if you can. In upcoming 4.9.3 we also have other Go runtime performance improvements: #3243 |
A coworker of mine found that replacing if reflect.TypeOf with ctx.(IParameterListContext) in the generated grammar improved the performance noticeably. I suggest we remove the use of reflect.TypeOf as much as possible in the Go implementation.
The text was updated successfully, but these errors were encountered: