optimize SqrtCache as just-an-array
This commit is contained in:
parent
5094d2d097
commit
e33ae65cd2
@ -13,12 +13,12 @@ import (
|
|||||||
"math"
|
"math"
|
||||||
)
|
)
|
||||||
|
|
||||||
var SqrtCache map[int]float64
|
var SqrtCache []float64
|
||||||
|
|
||||||
const MaxSqrtCache = 64
|
const MaxSqrtCache = 64
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
SqrtCache = make(map[int]float64, MaxSqrtCache)
|
SqrtCache = make([]float64, MaxSqrtCache)
|
||||||
for i := 0; i < MaxSqrtCache; i++ {
|
for i := 0; i < MaxSqrtCache; i++ {
|
||||||
SqrtCache[i] = math.Sqrt(float64(i))
|
SqrtCache[i] = math.Sqrt(float64(i))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user