Giter Club home page Giter Club logo

rust-memchr's Introduction

This crate provides a safe interface libc's memchr and memrchr. This crate also provides fallback implementations when either function is unavailable.

Build status Build status

Dual-licensed under MIT or the UNLICENSE.

Documentation

https://docs.rs/memchr

no_std

memchr links to the standard library by default, but you can disable the use_std feature if you want to use it in a #![no_std] crate:

[dependencies]
memchr = { version = "1.0", default-features = false }

Performance

On my system (Linux/amd64), memchr is about an order of magnitude faster than the more idiomatic haystack.iter().position(|&b| b == needle):

test iterator          ... bench:       5,280 ns/iter (+/- 13) = 1893 MB/s
test iterator_reversed ... bench:       5,271 ns/iter (+/- 7) = 1897 MB/s
test libc_memchr       ... bench:         202 ns/iter (+/- 0) = 49504 MB/s
test libc_memrchr      ... bench:         197 ns/iter (+/- 1) = 50761 MB/s

rust-memchr's People

Contributors

burntsushi avatar bluss avatar cholcombe973 avatar nicokoch avatar hywan avatar amanieu avatar mgeisler avatar mbrubeck avatar cbreeden avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.