mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-31 15:06:26 +00:00
wip
This commit is contained in:
parent
65dfdda14b
commit
a62b0ab12b
2 changed files with 29 additions and 24 deletions
|
@ -67,30 +67,6 @@ func (fs *streamFilter) apply(bs *blockSearch, bm *bitmap) {
|
|||
}
|
||||
}
|
||||
|
||||
type stringBucket struct {
|
||||
a []string
|
||||
}
|
||||
|
||||
func (sb *stringBucket) reset() {
|
||||
clear(sb.a)
|
||||
sb.a = sb.a[:0]
|
||||
}
|
||||
|
||||
func getStringBucket() *stringBucket {
|
||||
v := stringBucketPool.Get()
|
||||
if v == nil {
|
||||
return &stringBucket{}
|
||||
}
|
||||
return v.(*stringBucket)
|
||||
}
|
||||
|
||||
func putStringBucket(sb *stringBucket) {
|
||||
sb.reset()
|
||||
stringBucketPool.Put(sb)
|
||||
}
|
||||
|
||||
var stringBucketPool sync.Pool
|
||||
|
||||
func getTokensSkipLast(s string) []string {
|
||||
for {
|
||||
r, runeSize := utf8.DecodeLastRuneInString(s)
|
||||
|
|
29
lib/logstorage/stringbucket.go
Normal file
29
lib/logstorage/stringbucket.go
Normal file
|
@ -0,0 +1,29 @@
|
|||
package logstorage
|
||||
|
||||
import (
|
||||
"sync"
|
||||
)
|
||||
|
||||
type stringBucket struct {
|
||||
a []string
|
||||
}
|
||||
|
||||
func (sb *stringBucket) reset() {
|
||||
clear(sb.a)
|
||||
sb.a = sb.a[:0]
|
||||
}
|
||||
|
||||
func getStringBucket() *stringBucket {
|
||||
v := stringBucketPool.Get()
|
||||
if v == nil {
|
||||
return &stringBucket{}
|
||||
}
|
||||
return v.(*stringBucket)
|
||||
}
|
||||
|
||||
func putStringBucket(sb *stringBucket) {
|
||||
sb.reset()
|
||||
stringBucketPool.Put(sb)
|
||||
}
|
||||
|
||||
var stringBucketPool sync.Pool
|
Loading…
Reference in a new issue