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
cmd/5g: calling a method via interface is much slower in ARM #9636
Comments
The raspberry pi uses a very old arm processor. It may just be a difference in archs. |
Maybe it is simply that the ARM lacks some Intel feature that makes the call so fast, or maybe there is some optimization missing. Just in case I opened the issue. Regarding the func pointer, I'm not sure if you mean this: http://play.golang.org/p/tLq4vYMgql . In this case, for amd64 it is 0.4 vs. 5 ns/op. For ARM, it is 12 vs 63 ns/op, so the ratio is the same. |
I've checked disassembly, and it's as expected. Indirect calls are just expensive on arm11. Please try benchmark a C version with indirect function calls and see it's |
That sounds reasonable, an indirect jump through a register is harder to I look forward to spending some quality time with 5g after the c2go
|
for what its worth; the NVIDIA Jetson TK1 gave (using a recent tip build) |
The assembly is fine:
The problem appears to be that the Raspberry Pi is very slow at indirect calls. |
I've done a very simple program to benchmark a direct method call vs. method call via interface: http://play.golang.org/p/0yWkDh_fut
If I run it on amd64 I get very similar performance (using Go 1.4.1):
$ go test -bench=.
BenchmarkIntMethod 1000000000 2.22 ns/op
BenchmarkInterface 1000000000 2.60 ns/op
However, if I run it on ARM (Raspberry Pi), the interface benchmark is much slower:
$ go test -bench=.
BenchmarkIntMethod 100000000 16.1 ns/op
BenchmarkInterface 20000000 73.6 ns/op
Is this an expected behaviour?
The text was updated successfully, but these errors were encountered: