All Projects → llogiq → Bytecount

llogiq / Bytecount

Licence: other
Counting occurrences of a given byte or UTF-8 characters in a slice of memory – fast

Programming Languages

rust
11053 projects

Labels

Projects that are alternatives of or similar to Bytecount

Algorithm
「面试算法练级攻略」 - 「LeetCode题解」 - 「剑指offer题解」
Stars: ✭ 142 (-5.33%)
Mutual labels:  algorithm
Dice
Digital Image Correlation Engine (DICe): a stereo DIC application that runs on a desktop or high performance computing platform (massively parallel)
Stars: ✭ 144 (-4%)
Mutual labels:  algorithm
Algorithm
算法和数据结构练习(Leetcode)
Stars: ✭ 148 (-1.33%)
Mutual labels:  algorithm
E Books
A collections of FREE ebooks
Stars: ✭ 143 (-4.67%)
Mutual labels:  algorithm
Play With Data Structures
Codes of my MOOC Course <Play Data Structures in Java>. Updated contents and practices are also included. 我在慕课网上的课程《Java语言玩转数据结构》示例代码。课程的更多更新内容及辅助练习也将逐步添加进这个代码仓。
Stars: ✭ 1,878 (+1152%)
Mutual labels:  algorithm
Scene Text Recognition
Scene text detection and recognition based on Extremal Region(ER)
Stars: ✭ 146 (-2.67%)
Mutual labels:  algorithm
Rbush
RBush — a high-performance JavaScript R-tree-based 2D spatial index for points and rectangles
Stars: ✭ 1,881 (+1154%)
Mutual labels:  algorithm
Leetcode
LeetCode Problems' Solutions
Stars: ✭ 150 (+0%)
Mutual labels:  algorithm
Leetcode
leetcode刷题
Stars: ✭ 145 (-3.33%)
Mutual labels:  algorithm
Data structures and algorithms in python
📖 Worked Solutions of "Data Structures & Algorithms in Python", written by Michael T. Goodrich, Roberto Tamassia and Michael H. Goldwasser. ✏️
Stars: ✭ 147 (-2%)
Mutual labels:  algorithm
Yyw algorithm
💻我的leetcode算法题解,详细的java版本。包括分类题解/周赛题解/剑指OFFER题解
Stars: ✭ 143 (-4.67%)
Mutual labels:  algorithm
.codebits
📚 List of resources for Algorithms and Data Structures in Python & other CS topics @2017
Stars: ✭ 144 (-4%)
Mutual labels:  algorithm
Data Structure And Algorithms
Every thing related to data structure and algorithms.
Stars: ✭ 146 (-2.67%)
Mutual labels:  algorithm
Web Development Articles
Monthly Series - Top 10 Web Development Articles
Stars: ✭ 143 (-4.67%)
Mutual labels:  algorithm
Learn Python
Python Top 45 Articles of 2017
Stars: ✭ 148 (-1.33%)
Mutual labels:  algorithm
Lago
📕 Data Structures and Algorithms library in TypeScript
Stars: ✭ 1,966 (+1210.67%)
Mutual labels:  algorithm
Algorithm Pattern
算法模板,最科学的刷题方式,最快速的刷题路径,你值得拥有~
Stars: ✭ 12,970 (+8546.67%)
Mutual labels:  algorithm
Tradzqai
Trading environnement for RL agents, backtesting and training.
Stars: ✭ 150 (+0%)
Mutual labels:  algorithm
Dwifft
Swift Diff
Stars: ✭ 1,822 (+1114.67%)
Mutual labels:  algorithm
Competitive Programming
VastoLorde95's solutions to 2000+ competitive programming problems from various online judges
Stars: ✭ 147 (-2%)
Mutual labels:  algorithm

bytecount

Counting bytes really fast

Build Status Windows build status Current Version License: Apache 2.0/MIT

This uses the "hyperscreamingcount" algorithm by Joshua Landau to count bytes faster than anything else. The newlinebench repository has further benchmarks for old versions of this repository.

To use bytecount in your crate, if you have cargo-edit, just type cargo add bytecount in a terminal with the crate root as the current path. Otherwise you can manually edit your Cargo.toml to add bytecount = 0.5.1 to your [dependencies] section.

In your crate root (lib.rs or main.rs, depending on if you are writing a library or application), add extern crate bytecount;. Now you can simply use bytecount::count as follows:

extern crate bytecount;

fn main() {
    let mytext = "some potentially large text, perhaps read from disk?";
    let spaces = bytecount::count(mytext.as_bytes(), b' ');
    ..
}

bytecount supports two features to make use of modern CPU's features to speed up counting considerably. To allow your users to use them, add the following to your Cargo.toml:

[features]
runtime-dispatch-simd = ["bytecount/runtime-dispatch-simd"]
generic-simd = ["bytecount/generic-simd"]

The first, runtime-dispatch-simd, enables detection of SIMD capabilities at runtime, which allows using the SSE2 and AVX2 codepaths, but cannot be used with no_std.

Your users can then compile with runtime dispatch using:

cargo build --release --features runtime-dispatch-simd

The second, generic-simd, uses packed_simd to provide a fast architecture-agnostic SIMD codepath, but requires running on nightly.

Your users can compile with this codepath using:

cargo build --release --features generic-simd

Building for a more specific architecture will also improve performance. You can do this with

RUSTFLAGS="-C target-cpu=native" cargo build --release

The scalar algorithm is explained in depth here.

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, and at least 1.27.2 to use SIMD. Versions from 0.6.0 require Rust 1.32.0 or later.

License

Licensed under either of at your discretion:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].