You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
333 B
Go
26 lines
333 B
Go
package main
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/tal-tech/go-zero/core/fx"
|
|
)
|
|
|
|
func BenchmarkFx(b *testing.B) {
|
|
type Mixed struct {
|
|
Name string
|
|
Age int
|
|
Gender int
|
|
}
|
|
for i := 0; i < b.N; i++ {
|
|
var mx Mixed
|
|
fx.Parallel(func() {
|
|
mx.Name = "hello"
|
|
}, func() {
|
|
mx.Age = 20
|
|
}, func() {
|
|
mx.Gender = 1
|
|
})
|
|
}
|
|
}
|