On 23 Aug 2017, at 10:00, Deepak Jois <d...@dgraph.io> wrote: > > 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))[:val.mv_size:val.mv_size] > } > > Full code for context: > https://github.com/bmatsuo/lmdb-go/blob/master/lmdb/txn.go#L399 > > what happens with unsafe.Pointer? Doesnt it just return a pointer why > should it take up so much time in the CPU profile?
Are you sure it's not taking the getBytesCopy() path? The call may be inlined. //jb -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.