## Case-insensitive matching helpers
`EqualFold`, `IndexFold`, `ContainsFold`, `HasPrefixFold`, and
`HasSuffixFold` compare ASCII case-insensitively using the SWAR word
loops: only `A`..`Z`/`a`..`z` fold, every other byte (including bytes
>= 0x80) must match exactly. `HasPrefixFold` and `HasSuffixFold` cover
the header checks Fiber otherwise spells as an allocation-prone
`ToLower` + `HasPrefix`/`HasSuffix` pair (authorization schemes such as
`Bearer`, content-type prefixes such as `multipart/form-data`, suffixes
such as `+json`), and like the other Fold helpers they take the needle
as a plain string because call sites pass constant tokens. Their
`Benchmark_HasPrefixFold`/`Benchmark_HasSuffixFold` numbers are tracked
on the [benchmark charts](https://gofiber.github.io/utils/benchmarks/)
and join the catalog above on its next regeneration.
## HTTP dates
`AppendHTTPDate` and `FormatHTTPDate` write a time in the RFC 9110
preferred HTTP date format (`Mon, 02 Jan 2006 15:04:05 GMT`,
`net/http.TimeFormat`), byte-identical to `time.Format` with that layout
but without walking a layout string: the fixed-width template is copied
once and only the fields are overwritten. `ParseHTTPDate` is the reverse:
canonical preferred-format input takes a strict scalar fast path, and
everything else — the obsolete RFC 850 and asctime forms, unusual casing,
non-GMT zone names, padding — falls back to `time.Parse` with
`net/http.ParseTime` semantics, including its errors. `Date`,
`Last-Modified`, and `If-Modified-Since` handling sit on every
request/response, which makes these the highest-leverage helpers in this
group for Fiber.
## URL escaping
`AppendQueryEscape`/`AppendPathEscape` and
`AppendQueryUnescape`/`AppendPathUnescape` produce byte-identical results
(and, for the unescape pair, identical `url.EscapeError` values) to their
`net/url` counterparts, as append-style, allocation-free single passes.
The escape tables are pinned to `net/url.shouldEscape` by exhaustive
per-byte tests. Unescaping jumps between escape sites with the vectorized
scans (`IndexAny2` when `+` needs rewriting, `bytes.IndexByte` otherwise)
and copies clean spans wholesale, so route parameters and query values
without escapes — the common case — cost one scan and one copy. Decoding
never grows the input, so `dst` may be `s[:0]` on a common backing array
to unescape in place; escaping can grow the input, so there `dst` must
not alias `s`.
## JSON string escaping
`AppendJSONString` appends a value as a double-quoted JSON string,
byte-identical to `encoding/json.Marshal` of the same string — including
its default HTML escaping (`<`, `>`, `&`), the `\ufffd` replacement of
invalid UTF-8 bytes, and the U+2028/U+2029 escapes — without any of
`Marshal`'s reflection or allocation. Clean spans are located with a SWAR
scan (the same first-match-mask technique as `IndexNonQuotable`) and
copied wholesale. This is the building block for hand-rolled JSON hot
paths such as access-log lines and error bodies.
## IP address parsing
`ParseIPv4` and `ParseIPv6` parse addresses into `netip.Addr`, accepting
exactly the strings `netip.ParseAddr` accepts for the respective family
(pinned by fuzzing) while reporting failure with a `bool` instead of a
constructed error. Both take strings or byte slices, so fasthttp-style
callers skip the `string` conversion entirely; remote-address and
trusted-proxy checks parse an IP on every request in Fiber.
## Header key canonicalization
`CanonicalHeaderKey` Title-Cases an HTTP header key exactly like
`net/http.CanonicalHeaderKey`, including its return-unchanged guard for
keys containing non-token bytes. Already-canonical keys — the common case
on receive paths — are validated in a single table pass and returned
as-is with zero allocations for strings and byte slices alike. Keys that
do need rewriting cost one allocation; note that for the ~40 header names
in the stdlib's interning table the stdlib returns a cached string
without allocating, so this helper's edge there is time, not allocations.
These helpers were added on an amd64 machine, so like the `simd` numbers
their benchmarks are recorded separately from the arm64 catalog above and
join it on its next regeneration:
Environment:
goos: linux
goarch: amd64
pkg: github.com/gofiber/utils/v2
cpu: Intel(R) Xeon(R) Processor @ 2.80GHz
```text
// go test -benchmem -run=^$ -bench='Benchmark_(Append|Parse)HTTPDate|Benchmark_Append(Query|Path)|Benchmark_AppendJSONString|Benchmark_ParseIPv[46]|Benchmark_CanonicalHeaderKey' -count=1 .
Benchmark_AppendHTTPDate/fiber-4 24732448 50.32 ns/op 0 B/op 0 allocs/op
Benchmark_AppendHTTPDate/default-4 7009405 171.2 ns/op 0 B/op 0 allocs/op
Benchmark_ParseHTTPDate/fiber-4 35094189 32.26 ns/op 0 B/op 0 allocs/op
Benchmark_ParseHTTPDate/default-4 4741988 251.7 ns/op 0 B/op 0 allocs/op
Benchmark_AppendQueryEscape/clean-64B/fiber-4 18618994 64.21 ns/op 0 B/op 0 allocs/op
Benchmark_AppendQueryEscape/clean-64B/default-4 4653057 254.4 ns/op 0 B/op 0 allocs/op
Benchmark_AppendQueryEscape/mixed-64B/fiber-4 4637103 244.2 ns/op 0 B/op 0 allocs/op
Benchmark_AppendQueryEscape/mixed-64B/default-4 1600225 756.7 ns/op 192 B/op 2 allocs/op
Benchmark_AppendQueryUnescape/plain-64B/fiber-4 56108641 20.74 ns/op 0 B/op 0 allocs/op
Benchmark_AppendQueryUnescape/plain-64B/default-4 7959500 136.8 ns/op 0 B/op 0 allocs/op
Benchmark_AppendQueryUnescape/escaped-64B/fiber-4 4737538 250.3 ns/op 0 B/op 0 allocs/op
Benchmark_AppendQueryUnescape/escaped-64B/default-4 3816861 312.7 ns/op 48 B/op 1 allocs/op
Benchmark_AppendPathUnescape/plain-25B/fiber-4 74870614 16.38 ns/op 0 B/op 0 allocs/op
Benchmark_AppendPathUnescape/plain-25B/default-4 11201378 90.13 ns/op 0 B/op 0 allocs/op
Benchmark_AppendPathUnescape/escaped-31B/fiber-4 19748607 62.69 ns/op 0 B/op 0 allocs/op
Benchmark_AppendPathUnescape/escaped-31B/default-4 6227439 173.6 ns/op 24 B/op 1 allocs/op
Benchmark_AppendJSONString/clean-16B/fiber-4 47903053 22.13 ns/op 0 B/op 0 allocs/op
Benchmark_AppendJSONString/clean-16B/default-4 7762933 151.9 ns/op 40 B/op 2 allocs/op
Benchmark_AppendJSONString/clean-64B/fiber-4 18578377 64.12 ns/op 0 B/op 0 allocs/op
Benchmark_AppendJSONString/clean-64B/default-4 3901436 271.8 ns/op 96 B/op 2 allocs/op
Benchmark_AppendJSONString/escaped-64B/fiber-4 7056486 165.8 ns/op 0 B/op 0 allocs/op
Benchmark_AppendJSONString/escaped-64B/default-4 3842581 319.8 ns/op 96 B/op 2 allocs/op
Benchmark_AppendJSONString/unicode-64B/fiber-4 4654760 248.2 ns/op 0 B/op 0 allocs/op
Benchmark_AppendJSONString/unicode-64B/default-4 3786951 309.2 ns/op 112 B/op 2 allocs/op
Benchmark_ParseIPv4/fiber-4 52309202 20.02 ns/op 0 B/op 0 allocs/op
Benchmark_ParseIPv4/default-4 42021915 28.74 ns/op 0 B/op 0 allocs/op
Benchmark_ParseIPv6/compressed/fiber-4 22675394 51.88 ns/op 0 B/op 0 allocs/op
Benchmark_ParseIPv6/compressed/default-4 18522648 64.65 ns/op 0 B/op 0 allocs/op
Benchmark_ParseIPv6/full/fiber-4 20229412 61.40 ns/op 0 B/op 0 allocs/op
Benchmark_ParseIPv6/full/default-4 14830760 83.42 ns/op 0 B/op 0 allocs/op
Benchmark_CanonicalHeaderKey/canonical/fiber-4 54643375 22.69 ns/op 0 B/op 0 allocs/op
Benchmark_CanonicalHeaderKey/canonical/default-4 36882357 28.46 ns/op 0 B/op 0 allocs/op
Benchmark_CanonicalHeaderKey/common-lower/fiber-4 22508378 52.04 ns/op 16 B/op 1 allocs/op
Benchmark_CanonicalHeaderKey/common-lower/default-4 21160863 56.48 ns/op 0 B/op 0 allocs/op
Benchmark_CanonicalHeaderKey/custom-lower/fiber-4 17017753 73.05 ns/op 24 B/op 1 allocs/op
Benchmark_CanonicalHeaderKey/custom-lower/default-4 12678414 102.6 ns/op 24 B/op 1 allocs/op
```
## SWAR primitives
The [`swar`](swar/) package exports the SWAR (SIMD within a register)
building blocks the helpers above are composed from: `Load8`/`Store8`,
`Broadcast`, `ZeroLanes`, `MatchByteMask`/`MatchRangeMask`,
`ToLowerWord`/`ToUpperWord`, `FirstLane`/`LastLane`, and the `WordLen`,
`Ones`, `HighBits`, and `LowSeven` constants. They are exported so
downstream packages (Fiber itself, middleware) can fuse their own byte
scans — for example, finding a delimiter while classifying the bytes
before it — without re-deriving the bit tricks. The contracts (unchecked
bounds preconditions, `ZeroLanes`' approximate mask, the little-endian
lane order) and runnable examples live in the package documentation.
The package benchmarks its primitives against their stdlib counterparts
the same way the helpers above do, measuring the canonical loops composed
from them: `Load8`/`Store8` vs `encoding/binary`'s little-endian
`Uint64`/`PutUint64`, a `ZeroLanes` first-match scan vs
`strings.IndexByte`, a `MatchByteMask`+`LastLane` reverse scan vs
`bytes.LastIndexByte`, a `MatchRangeMask` digit scan vs
`strings.IndexAny`, and an in-place `ToLowerWord` loop vs
`bytes.ToLower`. The composed loops are pinned to the stdlib results by a
dedicated test, and the numbers are tracked per commit on the
[benchmark charts](https://gofiber.github.io/utils/benchmarks/). Note
that `strings.IndexByte` is hand-written SIMD assembly and overtakes the
portable SWAR scan on large inputs; the SWAR primitives earn their keep
on short HTTP-sized inputs and on fused scans the stdlib has no single
function for. The package's remaining benchmark, `Benchmark_Load8_Fusion`,
is an advisory codegen guard rather than an API performance promise, so
it is deliberately not part of the catalog above.
## SIMD-accelerated search (package simd)
The [`simd`](simd/) package is the vector-width counterpart to `swar`: byte
searching and validation whose scan kernels dispatch to AVX2 assembly (four
32-byte vectors per iteration) on amd64 CPUs for inputs of `simd.MinLen`
(32) bytes or more, and fall back to portable loops built on the `swar`
primitives everywhere else, so it builds and behaves identically on every
platform.
`simd.Accelerated()` reports which mode is active. CPU capability detection
uses [`golang.org/x/sys/cpu`](https://pkg.go.dev/golang.org/x/sys/cpu),
which also verifies OS support for saving the vector register state.
The AVX2-backed kernels are the multi-needle scans (`Memchr2`, `Memchr3`),
the paired-byte scan (`MemchrPair`), the class scans
(`MemchrDigit`/`MemchrDigitAt`, `MemchrWord`/`MemchrNotWord`), the ASCII
scans (`IsASCII`, `FirstNonASCII`, `CountNonASCII`), and the substring
search (`Memmem`), which
prefilters on the needle's rarest bytes (`SelectRareBytes`, `ByteRank`)
before verifying candidates — 2-6 byte needles containing two distinct
values are scanned for their two rarest bytes at the exact relative
distance, longer or single-valued needles for the single rarest byte.
Each kernel classifies four 32-byte vectors per iteration. Where the
result is a position or a yes/no, the four masks are combined, so a
128-byte block costs a single `VPMOVMSKB` and a single branch, and the
scans that report a position re-extract the four masks in address order on
the (rare) hit path. `CountNonASCII` is the exception — a count cannot be
recovered from a combined mask, so it extracts and population-counts all
four, and it is the one kernel gated on `POPCNT` in addition to AVX2.
One tier is documented explicitly as unaccelerated:
`MemchrInTable`/`MemchrNotInTable` are plain
scalar loops, since an arbitrary 256-entry membership test has no cheap
vector form. There is deliberately no single-needle `Memchr`:
`bytes.IndexByte` is already vector-accelerated by the Go runtime. `Memmem`
delegates to `bytes.Index` below 128 bytes — a conservative routing point
above the paired scan's measured break-even (`Benchmark_Memmem_Prefilter`
forces the prefilter helpers at every size to keep it measurable) — and
bails to `bytes.Index` after a bounded number of failed candidate
verifications, so even adversarial inputs — a rare byte everywhere plus a
long almost-matching needle — stay within a constant of the stdlib's
O(n+m) (see `Benchmark_Memmem_Adversarial`). The
package operates on `[]byte` only; the generic top-level helpers `IsASCII`,
`IndexAny2`, and `IndexAny3` dispatch into it automatically for inputs of
`simd.MinLen`+ bytes on amd64, which is where the AVX2 kernels overtake the
SWAR word loops (-35% to -88% ns/op at 32-512B in `benchstat -count=10`
runs; shorter inputs keep the existing SWAR paths).
The kernels are adapted from the [coregex](https://github.com/coregx/coregex)
project's `simd` package (MIT License, Copyright (c) 2025 Andrey Kolkov and
contributors; see [`simd/LICENSE`](simd/LICENSE)), with the legacy-SSE
register moves in the kernels replaced by VEX-encoded ones to avoid AVX-SSE
transition stalls, the scalar tail loops replaced by overlapping vector
rescans at the buffer end (a 63-byte scan previously cost ~3.7x a 64-byte
one), the 32-byte main loops replaced by 4x unrolled 128-byte blocks whose
bound is tested once at the bottom against a precomputed limit pointer, the
`\w` classifier rewritten from three `VPMINUB`/`VPMAXUB` clamp-and-compare
range tests into two `VPSHUFB` nibble-table lookups, `FirstNonASCII` and
`CountNonASCII` given kernels of their own (they were SWAR-only), and
the fallbacks reworked around the stdlib and the `swar` package as
described above.
Against the pre-unrolling kernels, `benchstat -count=10` on the machine
below reports -26.6%/-49.7% ns/op for `Memchr2` at 512B/4096B,
-17.6%/-34.3% for `Memchr3`, -13.4%/-24.6% for `MemchrPair`,
-39.2%/-50.5% for `MemchrDigit`, -53.5%/-63.7% for `MemchrNotWord`,
-42.2%/-65.7% for `IsASCII`, and -13.7%/-27.1% for `Memmem`, which rides
the paired scan. Those percentages come from `benchstat` over ten runs of
each side; the single-run table below is a catalog, not a base-vs-head
comparison, so subtracting its rows from an older copy of it will not
reproduce them.
Two bands see no benefit and are worth stating plainly. Inputs below
`simd.MinLen` never reach the kernels at all. Inputs of 32-127 bytes do
reach them but skip the 128-byte block loop, so they pay its setup with
nothing to amortize it against: across that band `benchstat` reports the
class scans clearly ahead (`MemchrNotWord` -8.6% at 32B, -18.4% at 64B;
`IsASCII` -5.0%/-4.3%), most rows statistically unchanged, and two small
regressions — `MemchrDigit` +5.6% at 32B and `Memchr3` +3.8% at 64B. Read
those small-input figures against the run's own noise floor: the `default`
legs call unchanged stdlib code, so their movement bounds what a delta of
that size means. They held within 1% in the run quoted here, but a later
run on the same machine drifted up to 17% on those same rows, so anything
under ~10% at 32-64B should be taken as "no measured change" unless its
control legs are quiet.
On the portable side, pinning each unrolled group of words with a reslice
before loading at constant offsets inside it removes the per-load bounds
check that `swar.Load8`'s own reslice otherwise repeats. Measured with
`benchstat -count=10` against the same fallbacks, at 32B/512B/4KiB:
`IsASCII` -28%/-60%/-63%, `CountNonASCII` -24%/-44%/-44%,
`FirstNonASCII` -23%/-37%/-43%, `Memchr2` -19%/-23%/-25%,
`MemchrDigit` -7%/-12%/-17%, `Memchr3` -8%/-13%/-18%,
`MemchrWord` -11%/-8%/-11%, `MemchrNotWord` -5%/-7%/-6%. The tier a group
adds costs one compare on inputs too short to use it, which shows up as
+3% to +10% on some of the 8B fallback rows — a few tenths of a
nanosecond, and only below the length where the group pays for itself.
`utils.IsASCII` carries the same rework, so the two copies of that scan
stay in step.
Making the counting kernel finish its own sub-vector remainder (rather
than splitting the input in Go and calling the SWAR loop for the tail)
also removed a second non-inlinable call from every whole-vector input:
`CountNonASCII` at 32B went from 11.3ns — behind its own fallback — to
6.8ns, level with it, and it leads from 64B up.
Because the AVX2 kernels only engage on amd64, their benchmark numbers are
recorded separately from the arm64 catalog above:
Environment:
goos: linux
goarch: amd64
pkg: github.com/gofiber/utils/v2/simd
cpu: Intel(R) Xeon(R) Processor @ 2.80GHz (AVX2)
```text
// go test ./simd/ -benchmem -run=^$ -bench=Benchmark_ -count=1
Benchmark_Memchr2/8B/simd-4 166775934 6.955 ns/op 0 B/op 0 allocs/op
Benchmark_Memchr2/8B/scalar-4 211595070 5.814 ns/op 0 B/op 0 allocs/op
Benchmark_Memchr2/8B/default-4 30108765 36.02 ns/op 0 B/op 0 allocs/op
Benchmark_Memchr2/32B/simd-4 188099018 6.475 ns/op 0 B/op 0 allocs/op
Benchmark_Memchr2/32B/scalar-4 100000000 10.15 ns/op 0 B/op 0 allocs/op
Benchmark_Memchr2/32B/default-4 25436731 45.07 ns/op 0 B/op 0 allocs/op
Benchmark_Memchr2/64B/simd-4 160683514 7.316 ns/op 0 B/op 0 allocs/op
Benchmark_Memchr2/64B/scalar-4 74313721 16.33 ns/op 0 B/op 0 allocs/op
Benchmark_Memchr2/64B/default-4 20844832 55.97 ns/op 0 B/op 0 allocs/op
Benchmark_Memchr2/512B/simd-4 81902580 14.97 ns/op 0 B/op 0 allocs/op
Benchmark_Memchr2/512B/scalar-4 10329916 118.8 ns/op 0 B/op 0 allocs/op
Benchmark_Memchr2/512B/default-4 3075676 393.0 ns/op 0 B/op 0 allocs/op
Benchmark_Memchr2/4096B/simd-4 18102721 68.61 ns/op 0 B/op 0 allocs/op
Benchmark_Memchr2/4096B/scalar-4 1416972 864.8 ns/op 0 B/op 0 allocs/op
Benchmark_Memchr2/4096B/default-4 402018 2983 ns/op 0 B/op 0 allocs/op
Benchmark_Memchr3/8B/simd-4 136411728 8.676 ns/op 0 B/op 0 allocs/op
Benchmark_Memchr3/8B/scalar-4 154497250 7.486 ns/op 0 B/op 0 allocs/op
Benchmark_Memchr3/8B/default-4 34597688 39.32 ns/op 0 B/op 0 allocs/op
Benchmark_Memchr3/32B/simd-4 156686616 7.817 ns/op 0 B/op 0 allocs/op
Benchmark_Memchr3/32B/scalar-4 85514072 14.02 ns/op 0 B/op 0 allocs/op
Benchmark_Memchr3/32B/default-4 34173225 34.18 ns/op 0 B/op 0 allocs/op
Benchmark_Memchr3/64B/simd-4 136311558 8.716 ns/op 0 B/op 0 allocs/op
Benchmark_Memchr3/64B/scalar-4 49021902 23.70 ns/op 0 B/op 0 allocs/op
Benchmark_Memchr3/64B/default-4 21518966 57.19 ns/op 0 B/op 0 allocs/op
Benchmark_Memchr3/512B/simd-4 64916151 19.62 ns/op 0 B/op 0 allocs/op
Benchmark_Memchr3/512B/scalar-4 7012357 162.1 ns/op 0 B/op 0 allocs/op
Benchmark_Memchr3/512B/default-4 2803662 392.5 ns/op 0 B/op 0 allocs/op
Benchmark_Memchr3/4096B/simd-4 11516102 98.47 ns/op 0 B/op 0 allocs/op
Benchmark_Memchr3/4096B/scalar-4 967389 1233 ns/op 0 B/op 0 allocs/op
Benchmark_Memchr3/4096B/default-4 372224 3004 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrPair/8B/simd-4 100000000 10.46 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrPair/8B/scalar-4 205322738 5.875 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrPair/32B/simd-4 55314021 20.89 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrPair/32B/scalar-4 57437145 21.17 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrPair/64B/simd-4 121543113 9.470 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrPair/64B/scalar-4 26435707 42.11 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrPair/512B/simd-4 54232755 19.35 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrPair/512B/scalar-4 2976901 347.0 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrPair/4096B/simd-4 13514536 88.98 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrPair/4096B/scalar-4 430855 2778 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrDigit/8B/simd-4 136738652 7.944 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrDigit/8B/scalar-4 209848646 5.301 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrDigit/32B/simd-4 180939722 6.379 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrDigit/32B/scalar-4 100000000 10.44 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrDigit/64B/simd-4 163112491 7.578 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrDigit/64B/scalar-4 69132280 16.96 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrDigit/512B/simd-4 82707004 14.48 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrDigit/512B/scalar-4 9733840 133.2 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrDigit/4096B/simd-4 15429883 81.41 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrDigit/4096B/scalar-4 1316628 923.9 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrWord/8B/simd-4 100000000 10.39 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrWord/8B/scalar-4 137844606 8.635 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrWord/32B/simd-4 171564747 7.032 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrWord/32B/scalar-4 49735075 23.14 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrWord/64B/simd-4 146017768 8.557 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrWord/64B/scalar-4 24390914 43.91 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrWord/512B/simd-4 61057335 19.83 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrWord/512B/scalar-4 2999950 351.0 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrWord/4096B/simd-4 10848006 111.5 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrWord/4096B/scalar-4 420418 2717 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrNotWord/8B/simd-4 100000000 10.44 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrNotWord/8B/scalar-4 129633012 9.306 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrNotWord/32B/simd-4 165562329 7.131 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrNotWord/32B/scalar-4 45987835 27.13 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrNotWord/64B/simd-4 132951244 8.781 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrNotWord/64B/scalar-4 24562381 49.54 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrNotWord/512B/simd-4 61239534 19.62 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrNotWord/512B/scalar-4 3130172 376.6 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrNotWord/4096B/simd-4 11077279 113.2 ns/op 0 B/op 0 allocs/op
Benchmark_MemchrNotWord/4096B/scalar-4 413086 3276 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem/8B/simd-4 100000000 10.99 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem/8B/default-4 133027675 9.593 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem/32B/simd-4 78421987 15.82 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem/32B/default-4 93988635 13.69 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem/64B/simd-4 63327909 19.84 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem/64B/default-4 68144829 16.73 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem/96B/simd-4 22108604 52.85 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem/96B/default-4 24109950 50.79 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem/128B/simd-4 46320181 24.47 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem/128B/default-4 16147812 64.02 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem/192B/simd-4 44552890 25.76 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem/192B/default-4 13128886 96.02 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem/512B/simd-4 35403554 32.31 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem/512B/default-4 4572046 267.1 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem/4096B/simd-4 11817771 112.8 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem/4096B/default-4 564676 2018 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem_Prefilter/8B/paired-4 74481417 14.55 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem_Prefilter/8B/paired-stdlib-4 132872514 9.482 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem_Prefilter/32B/paired-4 46307214 26.30 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem_Prefilter/32B/paired-stdlib-4 93691669 12.92 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem_Prefilter/32B/single-4 69403665 17.82 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem_Prefilter/32B/single-stdlib-4 72063870 17.05 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem_Prefilter/64B/paired-4 68429199 16.65 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem_Prefilter/64B/paired-stdlib-4 74431048 16.54 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem_Prefilter/64B/single-4 31007065 38.97 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem_Prefilter/64B/single-stdlib-4 30941724 40.61 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem_Prefilter/96B/paired-4 65736357 19.59 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem_Prefilter/96B/paired-stdlib-4 22522497 51.35 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem_Prefilter/96B/single-4 24870852 48.59 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem_Prefilter/96B/single-stdlib-4 29714346 43.42 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem_Prefilter/128B/paired-4 51420790 19.82 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem_Prefilter/128B/paired-stdlib-4 19055680 67.65 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem_Prefilter/128B/single-4 16195831 77.24 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem_Prefilter/128B/single-stdlib-4 23495053 52.67 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem_Prefilter/192B/paired-4 58638885 19.92 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem_Prefilter/192B/paired-stdlib-4 12657384 92.47 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem_Prefilter/192B/single-4 11716906 97.63 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem_Prefilter/192B/single-stdlib-4 14966446 82.35 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem_Prefilter/512B/paired-4 45954300 26.91 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem_Prefilter/512B/paired-stdlib-4 4483488 262.9 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem_Prefilter/512B/single-4 4513759 268.3 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem_Prefilter/512B/single-stdlib-4 4918275 243.2 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem_Prefilter/4096B/paired-4 11952480 97.35 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem_Prefilter/4096B/paired-stdlib-4 525157 2004 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem_Prefilter/4096B/single-4 607122 1988 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem_Prefilter/4096B/single-stdlib-4 621241 1973 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem_Adversarial/simd-4 698 1715647 ns/op 0 B/op 0 allocs/op
Benchmark_Memmem_Adversarial/default-4 718 1696956 ns/op 0 B/op 0 allocs/op
Benchmark_IsASCII/8B/simd-4 253699356 4.888 ns/op 0 B/op 0 allocs/op
Benchmark_IsASCII/8B/swar-4 390683442 2.872 ns/op 0 B/op 0 allocs/op
Benchmark_IsASCII/32B/simd-4 234724498 5.305 ns/op 0 B/op 0 allocs/op
Benchmark_IsASCII/32B/swar-4 247579681 4.774 ns/op 0 B/op 0 allocs/op
Benchmark_IsASCII/64B/simd-4 196755495 5.838 ns/op 0 B/op 0 allocs/op
Benchmark_IsASCII/64B/swar-4 200039208 6.085 ns/op 0 B/op 0 allocs/op
Benchmark_IsASCII/512B/simd-4 134683416 8.874 ns/op 0 B/op 0 allocs/op
Benchmark_IsASCII/512B/swar-4 52244253 23.74 ns/op 0 B/op 0 allocs/op
Benchmark_IsASCII/4096B/simd-4 31798422 36.09 ns/op 0 B/op 0 allocs/op
Benchmark_IsASCII/4096B/swar-4 6289762 185.5 ns/op 0 B/op 0 allocs/op
Benchmark_FirstNonASCII/8B/simd-4 167846630 6.921 ns/op 0 B/op 0 allocs/op
Benchmark_FirstNonASCII/8B/swar-4 274941226 4.198 ns/op 0 B/op 0 allocs/op
Benchmark_FirstNonASCII/32B/simd-4 230169858 5.258 ns/op 0 B/op 0 allocs/op
Benchmark_FirstNonASCII/32B/swar-4 201038061 5.939 ns/op 0 B/op 0 allocs/op
Benchmark_FirstNonASCII/64B/simd-4 202030548 5.904 ns/op 0 B/op 0 allocs/op
Benchmark_FirstNonASCII/64B/swar-4 155556992 7.710 ns/op 0 B/op 0 allocs/op
Benchmark_FirstNonASCII/512B/simd-4 96933100 12.02 ns/op 0 B/op 0 allocs/op
Benchmark_FirstNonASCII/512B/swar-4 23106508 51.56 ns/op 0 B/op 0 allocs/op
Benchmark_FirstNonASCII/4096B/simd-4 18463803 65.99 ns/op 0 B/op 0 allocs/op
Benchmark_FirstNonASCII/4096B/swar-4 3403281 340.4 ns/op 0 B/op 0 allocs/op
Benchmark_CountNonASCII/8B/simd-4 187364193 6.482 ns/op 0 B/op 0 allocs/op
Benchmark_CountNonASCII/8B/swar-4 238375552 4.760 ns/op 0 B/op 0 allocs/op
Benchmark_CountNonASCII/32B/simd-4 178751967 6.643 ns/op 0 B/op 0 allocs/op
Benchmark_CountNonASCII/32B/swar-4 181234458 6.927 ns/op 0 B/op 0 allocs/op
Benchmark_CountNonASCII/64B/simd-4 168405226 6.951 ns/op 0 B/op 0 allocs/op
Benchmark_CountNonASCII/64B/swar-4 100000000 10.22 ns/op 0 B/op 0 allocs/op
Benchmark_CountNonASCII/512B/simd-4 75394282 13.91 ns/op 0 B/op 0 allocs/op
Benchmark_CountNonASCII/512B/swar-4 23672272 51.57 ns/op 0 B/op 0 allocs/op
Benchmark_CountNonASCII/4096B/simd-4 19620422 60.02 ns/op 0 B/op 0 allocs/op
Benchmark_CountNonASCII/4096B/swar-4 2849376 419.4 ns/op 0 B/op 0 allocs/op
```
## ☕ Supporters
Fiber is an open-source project that runs on donations to pay the bills, e.g., our domain name, hosting, and serverless infrastructure. If you want to support Fiber, please become a [GitHub Sponsor](https://github.com/sponsors/gofiber).
Tool Sponsors - supporting Fiber with free IDE licenses and AI credits
### 📅 Monthly Sponsors
| 🔥 Fiber Guardian |  |
| ☕ Fiber Supporter |  |
| 🪴 Fiber Friend |  |
### 🎁 One-time Sponsors
| 🚀 Fiber Hero |  |
| 🪴 Fiber Friend |  |