mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
enhance: [2.5] Avoid stringtoslicebytes copy for BatchPKExists (#40097)
Cherry-pick from master pr: #40096 Using unsafe.Slice to convert string to []byte by directly using underlying data could avoid lots of copy and cpu time Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
parent
0caad5fe37
commit
898606ae4c
@ -18,6 +18,7 @@ package storage
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"unsafe"
|
||||
|
||||
"github.com/cockroachdb/errors"
|
||||
"github.com/samber/lo"
|
||||
@ -119,7 +120,7 @@ func Locations(pk PrimaryKey, k uint, bfType bloomfilter.BFType) []uint64 {
|
||||
return bloomfilter.Locations(buf, k, bfType)
|
||||
case schemapb.DataType_VarChar:
|
||||
varCharPk := pk.(*VarCharPrimaryKey)
|
||||
return bloomfilter.Locations([]byte(varCharPk.Value), k, bfType)
|
||||
return bloomfilter.Locations(unsafe.Slice(unsafe.StringData(varCharPk.Value), len(varCharPk.Value)), k, bfType)
|
||||
default:
|
||||
// TODO::
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user