Documentation
¶
Overview ¶
Package simd provides performance-optimized string operations using manual loop unrolling (processing 16 bytes per iteration). Despite the package name, these are NOT hardware SIMD/vector instructions — they are manually unrolled scalar loops that improve performance by reducing branch overhead and enabling better CPU pipelining. The Go compiler may auto-vectorize some patterns, but correctness does not depend on hardware SIMD support.
Index ¶
- func ContainsAny(s string, substrs []string) bool
- func ContainsWord(s, word string) bool
- func FastContains(s, substr string) bool
- func FastCountBytes(data string, target byte) int
- func FastEqual(a, b string) bool
- func FastHasANSI(data string) bool
- func FastLower(s string) string
- func HasANSI(data string) bool
- func IsWordChar(c byte) bool
- func Process(data string) string
- func SplitWords(input string) []string
- func StripANSI(input string) string
- type CPUFeatures
- type Dispatcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsAny ¶
ContainsAny checks if string contains any of the substrings
func ContainsWord ¶
ContainsWord checks if string contains word (space-delimited)
func FastContains ¶
FastContains checks if string contains substring (optimized for small patterns)
func FastCountBytes ¶
FastCountBytes counts bytes using SIMD-optimized loop
func FastHasANSI ¶
FastHasANSI checks for ANSI sequences using SIMD-friendly loop
func SplitWords ¶
SplitWords splits string into words (optimized)
Types ¶
type CPUFeatures ¶
CPUFeatures holds detected CPU capabilities
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher selects optimal SIMD implementation
func (*Dispatcher) EntropyFilter ¶
func (d *Dispatcher) EntropyFilter(data []float64) float64
EntropyFilter dispatches to SIMD or scalar