Skip to content

Commit

Permalink
add ResetTimer() to benchmark tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomi-3-0 committed Dec 8, 2023
1 parent 0241d2f commit 9f95006
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions pkg/hintrunner/hint_bechmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,15 @@ func BenchmarkUintDivMod(b *testing.B) {
var quotient ApCellRef = 1
var remainder ApCellRef = 2


b.ResetTimer()
for i := 0; i < b.N; i++ {
lhs := Immediate(randomFeltElement(rand))
rhs := Immediate(randomFeltElement(rand))
hint := DivMod{
lhs: lhs,
rhs: rhs,
quotient: quotient,
remainder: remainder,
lhs: lhs,
rhs: rhs,
quotient: quotient,
remainder: remainder,
}

err := hint.Execute(vm, nil)
Expand All @@ -166,6 +166,8 @@ func BenchmarkLinearSplit(b *testing.B) {

var x ApCellRef = 0
var y ApCellRef = 1

b.ResetTimer()
for i := 0; i < b.N; i++ {
value := Immediate(randomFeltElement(rand))
scalar := Immediate(randomFeltElement(rand))
Expand Down Expand Up @@ -201,6 +203,7 @@ func BenchmarkUint512DivModByUint256(b *testing.B) {
var remainder0 ApCellRef = 5
var remainder1 ApCellRef = 6

b.ResetTimer()
for i := 0; i < b.N; i++ {
dividend0 := Immediate(randomFeltElement(rand))
dividend1 := Immediate(randomFeltElement(rand))
Expand Down Expand Up @@ -246,6 +249,7 @@ func BenchmarkUint256SquareRoot(b *testing.B) {
var remainderHigh ApCellRef = 4
var sqrtMul2MinusRemainderGeU128 ApCellRef = 5

b.ResetTimer()
for i := 0; i < b.N; i++ {
valueLow := Immediate(randomFeltElement(rand))
valueHigh := Immediate(randomFeltElement(rand))
Expand Down

0 comments on commit 9f95006

Please sign in to comment.