mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-05 16:15:56 +00:00
This commit makes several changes to optimize the TopN() query: - Reduce highbits() back from 24-bits to 16-bits. - Reduce MaxArraySize back from 2^20 to 4096. - Optimize bitmap count invalidation. - Parallelize TopN() across nodes. - Parallelize TopN() across slices.
66 lines
1.1 KiB
Go
66 lines
1.1 KiB
Go
// +build amd64
|
|
|
|
package roaring
|
|
|
|
//go:noescape
|
|
var useAsm = hasAsm()
|
|
|
|
//go:noescape
|
|
func popcntSliceAsm(s []uint64) uint64
|
|
|
|
//go:noescape
|
|
func popcntMaskSliceAsm(s, m []uint64) uint64
|
|
|
|
//go:noescape
|
|
func popcntAndSliceAsm(s, m []uint64) uint64
|
|
|
|
//go:noescape
|
|
func popcntOrSliceAsm(s, m []uint64) uint64
|
|
|
|
//go:noescape
|
|
func popcntXorSliceAsm(s, m []uint64) uint64
|
|
|
|
//go:noescape
|
|
func popcntAsm(x uint64) uint64
|
|
|
|
func popcntSlice(s []uint64) uint64 {
|
|
if useAsm {
|
|
return popcntSliceAsm(s)
|
|
}
|
|
return popcntSliceGo(s)
|
|
}
|
|
|
|
func popcntMaskSlice(s, m []uint64) uint64 {
|
|
if useAsm {
|
|
return popcntMaskSliceAsm(s, m)
|
|
}
|
|
return popcntMaskSliceGo(s, m)
|
|
}
|
|
|
|
func popcntAndSlice(s, m []uint64) uint64 {
|
|
if useAsm {
|
|
return popcntAndSliceAsm(s, m)
|
|
}
|
|
return popcntAndSliceGo(s, m)
|
|
}
|
|
|
|
func popcntOrSlice(s, m []uint64) uint64 {
|
|
if useAsm {
|
|
return popcntOrSliceAsm(s, m)
|
|
}
|
|
return popcntOrSliceGo(s, m)
|
|
}
|
|
|
|
func popcntXorSlice(s, m []uint64) uint64 {
|
|
if useAsm {
|
|
return popcntXorSliceAsm(s, m)
|
|
}
|
|
return popcntXorSliceGo(s, m)
|
|
}
|
|
|
|
func popcnt(x uint64) uint64 {
|
|
if useAsm {
|
|
return popcntAsm(x)
|
|
}
|
|
return popcntGo(x)
|
|
}
|