Skip to content

Commit

Permalink
Remove map and use a slice
Browse files Browse the repository at this point in the history
  • Loading branch information
darkdrag00nv2 committed Nov 11, 2023
1 parent 7c2c51a commit 18eb5eb
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions runtime/interpreter/integer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ import (
const numGoRoutines = 100

func runBench(b *testing.B, getValue func(value int8, staticType StaticType) IntegerValue) {
semaToStaticType := make(map[sema.Type]StaticType)
staticTypes := make([]StaticType, 0)
for _, integerType := range sema.AllIntegerTypes {
switch integerType {
case sema.IntegerType, sema.SignedIntegerType:
continue
}

integerStaticType := ConvertSemaToStaticType(nil, integerType)
semaToStaticType[integerType] = integerStaticType
staticTypes = append(staticTypes, integerStaticType)
}

var wg sync.WaitGroup
Expand All @@ -47,13 +47,8 @@ func runBench(b *testing.B, getValue func(value int8, staticType StaticType) Int
defer wg.Done()

for i := 0; i <= math.MaxInt8; i++ {
for _, integerType := range sema.AllIntegerTypes {
switch integerType {
case sema.IntegerType, sema.SignedIntegerType:
continue
}

value := getValue(int8(i), semaToStaticType[integerType])
for _, integerType := range staticTypes {
value := getValue(int8(i), integerType)
runtime.KeepAlive(value)
}
}
Expand Down

0 comments on commit 18eb5eb

Please sign in to comment.