-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime/cgo: cgo call on Windows slower than Linux #5116
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
Labels
Comments
It looks like your C code is very quick. From: # hg st # go test -run=NONE -bench=xxh PASS Benchmark_xxhash32 10000000 137 ns/op Benchmark_goxxhash32 20000000 99.5 ns/op ok bitbucket.org/StephaneBunel/xxhash-go 3.618s if I just put "return" at the start of you C function, like: # hg st M C/xxhash.c # hg diff diff -r c77f1e3b34a6 C/xxhash.c --- a/C/xxhash.c Sun Mar 10 18:58:14 2013 +0100 +++ b/C/xxhash.c Mon Mar 25 13:57:49 2013 +1100 @@ -135,6 +135,7 @@ unsigned int XXH32(const void* input, int len, unsigned int seed) { + return 0; #if 0 // Simple version, good for code maintenance, but unfortunately slow for small inputs void* state = XXH32_init(seed); # go test -run=NONE -bench=xxh PASS Benchmark_xxhash32 20000000 107 ns/op Benchmark_goxxhash32 20000000 99.2 ns/op ok bitbucket.org/StephaneBunel/xxhash-go 4.349s # benchmark does not change much. So really you are not benchmarking your code, but how fast Go to C interface is. You have discovered that linux is running switching code faster then windows, and, perhaps, it is. Feel free to improve that, if you like. Alex |
Yeah you are right, I'm searching right now why this is happening exactly 1.0.3 switch is faster than tip switch btw go version go1.0.3 (386) Benchmark_xxhash32 50000000 45.4 ns/op Benchmark_goxxhash32 5000000 364 ns/op go version devel +f78c5036b7f6 Mon Mar 25 08:58:13 2013 -0700 windows/386 Benchmark_xxhash32 50000000 69.6 ns/op Benchmark_goxxhash32 50000000 61.0 ns/op |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by Vova616:
The text was updated successfully, but these errors were encountered: