[go-nuts] Copying slice over itself

2017-09-06 Thread Deepak Jois
Hi Pls look at this code: https://play.golang.org/p/QfQOo1iyp4 I am copying a slice over itself. How does it work internally? Does the copy operation optimise for this, and not perform any copying in this case? I have to deal with a situation where I get a slice reference back from a function, a

[go-nuts] Making sense of Go profiling output

2017-08-23 Thread Deepak Jois
I am profiling a Go program that calls into C using cgo, and then tries to get a pointer to unsafe data. In the profiling, I see that over 62% of the time is spent in a call which is of the form func getBytes(val *C.MDB_val) []byte { return (*[valMaxSize]byte)(unsafe.Pointer(val.mv_data))[:va