Skip to content

Commit

Permalink
Use sprintf to fix no allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
darkdrag00nv2 committed Nov 11, 2023
1 parent 18eb5eb commit 3836f60
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion runtime/interpreter/integer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package interpreter

import (
"fmt"
"math"
"runtime"
"sync"
Expand Down Expand Up @@ -49,7 +50,8 @@ func runBench(b *testing.B, getValue func(value int8, staticType StaticType) Int
for i := 0; i <= math.MaxInt8; i++ {
for _, integerType := range staticTypes {
value := getValue(int8(i), integerType)
runtime.KeepAlive(value)
str := fmt.Sprintf("Value = %d", value)
runtime.KeepAlive(str)
}
}
}
Expand Down

0 comments on commit 3836f60

Please sign in to comment.