{"id":16680911,"url":"https://github.com/llogiq/bytecount","last_synced_at":"2025-05-15T15:02:10.369Z","repository":{"id":11344064,"uuid":"69268738","full_name":"llogiq/bytecount","owner":"llogiq","description":"Counting occurrences of a given byte or UTF-8 characters in a slice of memory – fast","archived":false,"fork":false,"pushed_at":"2024-10-03T15:45:24.000Z","size":124,"stargazers_count":227,"open_issues_count":8,"forks_count":28,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-05-03T00:42:08.257Z","etag":null,"topics":["algorithm","byte-count","hacktoberfest","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/llogiq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.Apache2","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":"2016-09-26T16:17:32.000Z","updated_at":"2025-03-28T02:10:01.000Z","dependencies_parsed_at":"2023-09-27T02:41:28.193Z","dependency_job_id":"b60d6c8e-711e-4d42-92e1-61ec89138b9e","html_url":"https://github.com/llogiq/bytecount","commit_stats":{"total_commits":113,"total_committers":20,"mean_commits":5.65,"dds":0.5221238938053097,"last_synced_commit":"240c02ce229a0b4901048cab2085d59dd12145ae"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/llogiq%2Fbytecount","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/llogiq%2Fbytecount/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/llogiq%2Fbytecount/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/llogiq%2Fbytecount/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/llogiq","download_url":"https://codeload.github.com/llogiq/bytecount/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254036832,"owners_count":22003661,"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":["algorithm","byte-count","hacktoberfest","rust"],"created_at":"2024-10-12T13:44:16.737Z","updated_at":"2025-05-15T15:02:10.224Z","avatar_url":"https://github.com/llogiq.png","language":"Rust","readme":"# bytecount\n\nCounting bytes really fast\n\n[![Continuous integration](https://github.com/llogiq/bytecount/actions/workflows/ci.yml/badge.svg)](https://github.com/llogiq/bytecount/actions/workflows/ci.yml)\n[![Windows build status](https://ci.appveyor.com/api/projects/status/github/llogiq/bytecount?svg=true)](https://ci.appveyor.com/project/llogiq/bytecount)\n[![Current Version](https://img.shields.io/crates/v/bytecount.svg)](https://crates.io/crates/bytecount)\n[![License: Apache 2.0/MIT](https://img.shields.io/crates/l/bytecount.svg)](#license)\n\nThis uses the \"hyperscreamingcount\" algorithm by Joshua Landau to count bytes faster than anything else.\nThe [newlinebench](https://github.com/llogiq/newlinebench) repository has further benchmarks for old versions of this repository.\n\nTo use bytecount in your crate, if you have [cargo-edit](https://github.com/killercup/cargo-edit), just type\n`cargo add bytecount` in a terminal with the crate root as the current path. Otherwise you can manually edit your\n`Cargo.toml` to add `bytecount = 0.6.8` to your `[dependencies]` section.\n\nIn your crate root (`lib.rs` or `main.rs`, depending on if you are writing a\nlibrary or application), add `extern crate bytecount;`. Now you can simply use\n`bytecount::count` as follows:\n\n```Rust\nextern crate bytecount;\n\nfn main() {\n    let mytext = \"some potentially large text, perhaps read from disk?\";\n    let spaces = bytecount::count(mytext.as_bytes(), b' ');\n    ..\n}\n```\n\nbytecount supports two features to make use of modern CPU's features to speed up counting considerably. To allow your\nusers to use them, add the following to your `Cargo.toml`:\n\n```\n[features]\nruntime-dispatch-simd = [\"bytecount/runtime-dispatch-simd\"]\ngeneric-simd = [\"bytecount/generic-simd\"]\n```\n\nThe first, `runtime-dispatch-simd`, enables detection of SIMD capabilities at runtime, which allows using the SSE2 and\nAVX2 codepaths, but cannot be used with `no_std`.\n\nYour users can then compile with runtime dispatch using:\n\n```\ncargo build --release --features runtime-dispatch-simd\n```\n\nThe second, `generic-simd`, uses [`std::simd`](https://doc.rust-lang.org/std/simd/index.html) and [`#![feature(portable_simd)]`](https://github.com/rust-lang/rust/issues/86656) to provide a fast\narchitecture-agnostic SIMD codepath, but requires running on nightly.\n\nYour users can compile with this codepath using:\n\n```\ncargo build --release --features generic-simd\n```\n\nBuilding for a more specific architecture will also improve performance.\nYou can do this with\n\n```\nRUSTFLAGS=\"-C target-cpu=native\" cargo build --release\n```\n\nThe scalar algorithm is explained in depth [here](https://llogiq.github.io/2016/09/27/count.html).\n\n**Note: Versions until 0.4.0 worked with Rust as of 1.20.0. Version 0.5.0 until 0.6.0 requires Rust 1.26 or later,\nand at least 1.27.2 to use SIMD. Versions from 0.6.0 require Rust 1.32.0 or later.**\n\n## License\n\nLicensed under either of at your discretion:\n\n- [Apache 2.0](LICENSE.Apache2)\n- [MIT](LICENSE.MIT)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fllogiq%2Fbytecount","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fllogiq%2Fbytecount","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fllogiq%2Fbytecount/lists"}