Exemplo n.º 1
0
func BenchmarkEvaluateMany(b *testing.B) {
	const (
		ni = 2
		no = 1000
	)

	fixture := &fixture{
		rule:   "closed",
		target: many(ni, no),
		surrogate: &algorithm.Surrogate{
			Inputs:  ni,
			Outputs: no,
		},
	}
	fixture.initialize()

	algorithm, strategy := prepare(fixture)
	surrogate := algorithm.Compute(fixture.target, strategy)
	points := generate(surrogate)

	b.ResetTimer()

	for i := 0; i < b.N; i++ {
		algorithm.Evaluate(surrogate, points)
	}
}
Exemplo n.º 2
0
func BenchmarkEvaluateHat(b *testing.B) {
	fixture := &fixtureHat
	algorithm, strategy := prepare(fixture)
	surrogate := algorithm.Compute(fixture.target, strategy)
	points := generate(surrogate)

	b.ResetTimer()

	for i := 0; i < b.N; i++ {
		algorithm.Evaluate(surrogate, points)
	}
}