-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime: go1.5 works slower than go1.4? #11114
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
Comments
Some parts are faster and some parts are slower. On average, it's faster overall. Do you have a specific repro case? |
Dear bradfitz, package main
// #include <stdio.h>
// #include <stdlib.h>
/*
void process(char *str) {
//printf("%s\n", str);
if(str!=NULL)
{
strstr(str,"Hello");
strstr(str,"Cgo");
}
}
*/
import "C"
import "unsafe"
import (
"fmt"
"time"
)
func test1() {
s := "Hello Cgo"
cs := C.CString(s)
C.process(cs)
C.free(unsafe.Pointer(cs))
}
func test2(done chan int) {
s := "Hello Cgo"
cs := C.CString(s)
C.process(cs)
C.free(unsafe.Pointer(cs))
done <- 1
}
func main() {
//test1
count := 1000000
t1 := time.Now()
for i := 0; i < count; i++ {
test1()
}
t2 := time.Since(t1)
fmt.Println("test1 time used:", t2)
//test2
count = 1000000
t1 = time.Now()
done := make(chan int)
for i := 0; i < count; i++ {
go test2(done)
}
for {
<-done
count = count - 1
if count == 0 {
break
}
}
t2 = time.Since(t1)
fmt.Println("time used:", t2)
} |
Try with GOMAXPROCS=1. The default in Go 1.5 will be that GOMAXPROCS=NumCPU |
I suspect this might just be a dup of #9704 Let's move this to the golang-nuts@ mailing list until a specific bug is identified. |
I have built and installed go1.5 from source, and use it to build my project. But i find it works slower than
built from go1.4.2. the performance is only 60% as it built from go1.4.2. My project uses a lot of goroutines to call rocksdb which is implmented by c.
I have heared of go1.5 will work faster than go1.4, but what i see is not as that at current time. Will go1.5 work faster in release version?
The text was updated successfully, but these errors were encountered: