0
0

optimize SqrtCache as just-an-array

This commit is contained in:
Steve Yen 2016-07-21 19:41:10 -07:00
parent 5094d2d097
commit e33ae65cd2

View File

@ -13,12 +13,12 @@ import (
"math"
)
var SqrtCache map[int]float64
var SqrtCache []float64
const MaxSqrtCache = 64
func init() {
SqrtCache = make(map[int]float64, MaxSqrtCache)
SqrtCache = make([]float64, MaxSqrtCache)
for i := 0; i < MaxSqrtCache; i++ {
SqrtCache[i] = math.Sqrt(float64(i))
}