{"id":15715350,"url":"https://github.com/cloudflare/sliceslice-rs","last_synced_at":"2025-04-09T06:09:57.154Z","repository":{"id":38201738,"uuid":"277662142","full_name":"cloudflare/sliceslice-rs","owner":"cloudflare","description":"A fast implementation of single-pattern substring search using SIMD acceleration.","archived":false,"fork":false,"pushed_at":"2024-09-26T15:09:08.000Z","size":358,"stargazers_count":96,"open_issues_count":9,"forks_count":18,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-02T04:05:50.080Z","etag":null,"topics":["avx2","search-in-text","simd","simd-instructions","simd-programming","substring-search","text-processing"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudflare.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-06T22:32:01.000Z","updated_at":"2025-03-05T01:00:55.000Z","dependencies_parsed_at":"2024-06-29T09:41:41.899Z","dependency_job_id":"46c74754-61d0-43b1-9844-5490565c4399","html_url":"https://github.com/cloudflare/sliceslice-rs","commit_stats":{"total_commits":108,"total_committers":3,"mean_commits":36.0,"dds":"0.33333333333333337","last_synced_commit":"b69061baad0369d5c909310e1930b331d3a16494"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2Fsliceslice-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2Fsliceslice-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2Fsliceslice-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2Fsliceslice-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudflare","download_url":"https://codeload.github.com/cloudflare/sliceslice-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247987285,"owners_count":21028895,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["avx2","search-in-text","simd","simd-instructions","simd-programming","substring-search","text-processing"],"created_at":"2024-10-03T21:41:03.096Z","updated_at":"2025-04-09T06:09:57.140Z","avatar_url":"https://github.com/cloudflare.png","language":"Rust","funding_links":[],"categories":["Networking \u0026 Performance"],"sub_categories":["Data Processing"],"readme":"# sliceslice\n\n[![Actions](https://github.com/cloudflare/sliceslice-rs/workflows/Check/badge.svg)](https://github.com/cloudflare/sliceslice-rs/actions)\n[![Crate](https://img.shields.io/crates/v/sliceslice)](https://crates.io/crates/sliceslice)\n[![Docs](https://docs.rs/sliceslice/badge.svg)](https://docs.rs/sliceslice)\n[![License](https://img.shields.io/crates/l/sliceslice)](LICENSE)\n\nA fast implementation of single-pattern substring search using SIMD acceleration, based on the work [presented by Wojciech Muła](http://0x80.pl/articles/simd-strfind.html). For a fast multi-pattern substring search algorithm, see instead the [`aho-corasick` crate](https://github.com/BurntSushi/aho-corasick).\n\n## Example\n\n```rust\nuse sliceslice::x86::DynamicAvx2Searcher;\n\nfn main() {\n    let searcher = unsafe { DynamicAvx2Searcher::new(b\"ipsum\".to_owned().into()) };\n\n    assert!(unsafe {\n        searcher.search_in(b\"Lorem ipsum dolor sit amet, consectetur adipiscing elit\")\n    });\n\n    assert!(!unsafe {\n        searcher.search_in(b\"foo bar baz qux quux quuz corge grault garply waldo fred\")\n    });\n}\n```\n\n## Benchmarks\n\nWe ran the **[`i386` benchmarks](bench/benches/i386.rs)** on an **HP EliteDesk 800 G2 Tower PC** with an **Intel Core i7-6700 Processor @ 3.40GHz**, **16GB of RAM** and **512GB** of disk space, running **Ubuntu 20.04.1 LTS**, **gcc 9.3.0** and **Rust 1.46.0**.\n\n| **Library**                                                   | **Version**   | **Function**                                                                                                                           | **Short haystack**                  | **Long haystack**                   |\n| ------------------------------------------------------------- | ------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- | ----------------------------------- |\n| [std](https://doc.rust-lang.org/std/)                         | 1.46.0        | [`String::find`](https://doc.rust-lang.org/1.46.0/std/string/struct.String.html#method.find)                                           | [335.32 ms 335.56 ms 335.83 ms]     | [344.62 ms 345.01 ms 345.52 ms]     |\n| [memmem](https://github.com/jneem/memmem)                     | 0.1.1         | [`TwoWaySearcher::search_in`](https://docs.rs/memmem/0.1.1/memmem/struct.TwoWaySearcher.html#method.search_in)                         | [87.927 ms 88.029 ms 88.151 ms]     | [401.40 ms 401.59 ms 401.81 ms]     |\n| [twoway](https://github.com/bluss/twoway)                     | 0.2.1         | [`find_bytes`](https://docs.rs/twoway/0.2.1/twoway/fn.find_bytes.html)                                                                 | [274.60 ms 274.82 ms 275.07 ms]     | [146.32 ms 146.44 ms 146.58 ms]     |\n| [sse4-strstr](https://github.com/WojciechMula/sse4-strstr)¹   | 0.0.0-9308a59 | [`avx2_strstr_v2`](https://github.com/WojciechMula/sse4-strstr/blob/9308a59891f694f63ad6e55e387d244ea7ca4209/avx2-strstr-v2.cpp#L201)  | [75.389 ms 75.515 ms 75.682 ms]     | [38.521 ms 38.579 ms 38.649 ms]     |\n| **[sliceslice](https://github.com/cloudflare/sliceslice-rs)** | **0.2.0**     | **[`DynamicAvx2Searcher::search_in`](https://docs.rs/sliceslice/0.2.0/sliceslice/x86/enum.DynamicAvx2Searcher.html#method.search_in)** | **[79.283 ms 79.416 ms 79.596 ms]** | **[35.135 ms 35.181 ms 35.247 ms]** |\n\n¹ sse4-strstr is not memory safe as it can read beyond the end of the haystack, please see the documentation for sliceslice where this is discussed in more detail.\n\n![Benchmarks results column chart](benchmarks.svg)\n\n## Licensing\n\nLicensed under the MIT license. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudflare%2Fsliceslice-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudflare%2Fsliceslice-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudflare%2Fsliceslice-rs/lists"}