最近在做C++代码到Go代码的翻译中,发现不少Go语言性能上与C++代码的差距。
本文介绍下 Interface接口传参的性能问题。
测试代码
package benchmarks
import "testing"
type ITestObj interface {
GetPropX() int
SetPropX(x int)
}
type Obj struct {
X int
}
func (this *Obj) GetPropX() int {
最近在做C++代码到Go代码的翻译中,发现不少Go语言性能上与C++代码的差距。
本文介绍下 Interface接口传参的性能问题。
package benchmarks
import "testing"
type ITestObj interface {
GetPropX() int
SetPropX(x int)
}
type Obj struct {
X int
}
func (this *Obj) GetPropX() int {