github.com/enetx/g@v1.0.80/tests/set_benchmark_test.go (about) 1 package g_test 2 3 import ( 4 "testing" 5 6 "github.com/enetx/g" 7 ) 8 9 // go test -bench=. -benchmem -count=4 10 11 func genSet() g.Set[g.String] { 12 slice := g.NewSlice[g.String](0, 10000) 13 for i := range 10000 { 14 slice = slice.Append(g.NewInt(i).ToString()) 15 } 16 17 return g.SetOf(slice...) 18 } 19 20 func BenchmarkSymmetricDifference(b *testing.B) { 21 set1 := genSet() 22 set2 := genSet() 23 24 b.ResetTimer() 25 26 for n := 0; n < b.N; n++ { 27 set1.SymmetricDifference(set2).Collect() 28 } 29 }