Skip to content

Commit

Permalink
evaluation: add more cases to evaluator benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
e0ff committed Nov 26, 2023
1 parent 2347b4b commit c0f1b21
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions internal/evaluation/evaluator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,25 @@ import (
"testing"
)

func BenchmarkEvaluate(b *testing.B) {
position, _ := chess.NewPosition(chess.StartingFen)
func evaluateBenchmark(b *testing.B, fen string) {
position, _ := chess.NewPosition(fen)
evaluator := NewEvaluator()

for i := 0; i < b.N; i++ {
evaluator.Evaluate(position)
}
}

func BenchmarkEvaluate(b *testing.B) {
cases := []string{
chess.StartingFen,
"7R/5pkp/4pN2/4P1P1/6K1/6P1/q1r5/7r w - - 1 46",
"Bn2kbnr/p1p1pppp/3q4/8/3P4/2N3Pb/PPP2P1P/R1BQR1K1 b k - 0 13",
}

for _, c := range cases {
b.Run(c, func(b *testing.B) {
evaluateBenchmark(b, c)
})
}
}

0 comments on commit c0f1b21

Please sign in to comment.