https://github.com/freaky/fast-memchr
A port of rust-memchr's fallback and SSE2 memchr() to C
https://github.com/freaky/fast-memchr
Last synced: 11 months ago
JSON representation
A port of rust-memchr's fallback and SSE2 memchr() to C
- Host: GitHub
- URL: https://github.com/freaky/fast-memchr
- Owner: Freaky
- License: unlicense
- Created: 2019-01-09T17:35:56.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-10T20:44:23.000Z (over 7 years ago)
- Last Synced: 2025-06-06T10:01:42.037Z (about 1 year ago)
- Language: C
- Homepage:
- Size: 231 KB
- Stars: 19
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-MIT
Awesome Lists containing this project
README
# fast-memchr
This is a port of [rust-memchr]'s [fallback][original] and [SSE2] `memchr()`
implementations to C. It is distributed under the same licenses: MIT and
UNLICENSE.
In my limited tests, the fallback version ranges from about equal to 5.5x faster
than FreeBSD's stock `memchr()` (a simple bytewise loop) on amd64.
On i386 it's about 2.6x slower; 1.7x slower if `uintptr_t` is replaced with
`uint64_t`.
The SSE2 version is about 2.5-13x faster.
[rust-memchr]: https://github.com/BurntSushi/rust-memchr
[original]: https://github.com/BurntSushi/rust-memchr/blob/b0a29f267f4a7fad8ffcc8fe8377a06498202883/src/fallback.rs#L45-L81
[sse2]: https://github.com/BurntSushi/rust-memchr/blob/b0a29f267f4a7fad8ffcc8fe8377a06498202883/src/x86/sse2.rs#L18-L187