We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1d95b47 commit a536b72Copy full SHA for a536b72
parser.go
@@ -64,10 +64,7 @@ func (c *cache) reset() {
64
c.vs = c.vs[:0]
65
}
66
67
-const (
68
- minPreAllocatedCacheSize = 256
69
- maxPreAllocatedCacheSize = 32768
70
-)
+const preAllocatedCacheSize = 32768
71
72
func (c *cache) getValue() *Value {
73
last := len(c.vs) - 1
@@ -77,12 +74,7 @@ func (c *cache) getValue() *Value {
77
74
if cap(c.vs) > len(c.vs) {
78
75
c.vs = c.vs[:len(c.vs)+1]
79
76
} else {
80
- c.allocated++
81
- newSz := minPreAllocatedCacheSize * c.allocated
82
- if newSz > maxPreAllocatedCacheSize {
83
- newSz = maxPreAllocatedCacheSize
84
- }
85
- c.vs = append(c.vs, make([]Value, 0, newSz))
+ c.vs = append(c.vs, make([]Value, 0, preAllocatedCacheSize))
86
87
last = len(c.vs) - 1
88
needExt = false
0 commit comments