Documentation
¶
Overview ¶
Package simd provides SIMD-optimized operations for Tokman compression. Requires Go 1.26+ with GOEXPERIMENT=simd for native SIMD support.
Index ¶
- Variables
- func ContainsAny(s string, substrs []string) bool
- func ContainsWord(s, w string) bool
- func CountBrackets(s string, pairs []BracketPair) (opens, closes int)
- func CountByte(s string, c byte) int
- func CountByteSet(s string, set []byte) int
- func FindWordBoundary(s string, pos int) int
- func HasANSI(input string) bool
- func IndexByte(s string, c byte) int
- func IndexByteSet(s string, set []byte) int
- func IsWhitespace(c byte) bool
- func IsWordChar(c byte) bool
- func Memcmp(a, b []byte) int
- func Memset(buf []byte, c byte)
- func SplitWords(s string) []string
- func StripANSI(input string) string
- type BracketPair
- type SIMDAccelerator
Constants ¶
This section is empty.
Variables ¶
var DefaultBracketPairs = []BracketPair{
{'{', '}'},
{'[', ']'},
{'(', ')'},
{'<', '>'},
}
var Enabled bool
Enabled reports whether SIMD optimizations are available.
Functions ¶
func ContainsAny ¶
ContainsAny checks if s contains any of the substrings. Uses first-character matching for speed.
func ContainsWord ¶
ContainsWord checks if s contains the word w (whole word matching).
func CountBrackets ¶
func CountBrackets(s string, pairs []BracketPair) (opens, closes int)
CountBrackets counts opening and closing brackets in s.
func CountByteSet ¶
CountByteSet counts occurrences of any byte in set.
func FindWordBoundary ¶
FindWordBoundary finds the next word boundary starting from pos. Returns the position of the next non-word character or end of string.
func IndexByte ¶
IndexByte finds the first occurrence of c in s using the standard library's SIMD-optimized implementation.
func IndexByteSet ¶
IndexByteSet finds the first occurrence of any byte in set. Uses a lookup table for fast byte set membership testing.
func IsWordChar ¶
IsWordChar checks if a byte is part of a word (alphanumeric or underscore).
func SplitWords ¶
SplitWords splits string into words using SIMD-optimized scanning.
Types ¶
type BracketPair ¶
type BracketPair struct {
Open, Close byte
}
BracketPair represents a pair of matching brackets.
type SIMDAccelerator ¶
type SIMDAccelerator struct {
// contains filtered or unexported fields
}
func NewSIMDAccelerator ¶
func NewSIMDAccelerator() *SIMDAccelerator
func (*SIMDAccelerator) CompareBytes ¶
func (s *SIMDAccelerator) CompareBytes(a, b []byte) bool
func (*SIMDAccelerator) CountBytes ¶
func (s *SIMDAccelerator) CountBytes(data []byte, target byte) int
func (*SIMDAccelerator) Features ¶
func (s *SIMDAccelerator) Features() map[string]bool
func (*SIMDAccelerator) HasSIMD ¶
func (s *SIMDAccelerator) HasSIMD() bool