c-for-go icon indicating copy to clipboard operation
c-for-go copied to clipboard

Avoid lock / unlock for some function call

Open leslie-wang opened this issue 2 years ago • 0 comments

@xlab I'm trying to compare the auto-generated code https://github.com/leslie-wang/opus-go/blob/latest-c-for-go/opus/opus.go and the manual generated one https://github.com/hraban/opus/blob/v2/encoder.go, seems like the auto generated one calls function copyPInt16Bytes twice, in which lock/unlock always happen. It means everytime calling c function will lock/unlock which is an expensive operation. Actually the earlier version https://github.com/xlab/opus-go/blob/master/opus/opus.go won't do lock/unlock either. Is there any rational behind it? Is it possible to avoid it?

leslie-wang avatar Dec 27 '22 07:12 leslie-wang