GithubHelp home page GithubHelp logo

davidbjaffe / twox-hash Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shepmaster/twox-hash

0.0 0.0 0.0 1.77 MB

A Rust implementation of the XXHash algorithm.

License: MIT License

Rust 100.00%

twox-hash's Introduction

TwoX-Hash

A Rust implementation of the XXHash algorithm.

Build Status Current Version

Documentation

Examples

With a fixed seed

use std::hash::BuildHasherDefault;
use std::collections::HashMap;
use twox_hash::XxHash64;

let mut hash: HashMap<_, _, BuildHasherDefault<XxHash64>> = Default::default();
hash.insert(42, "the answer");
assert_eq!(hash.get(&42), Some(&"the answer"));

With a random seed

use std::collections::HashMap;
use twox_hash::RandomXxHashBuilder64;

let mut hash: HashMap<_, _, RandomXxHashBuilder64> = Default::default();
hash.insert(42, "the answer");
assert_eq!(hash.get(&42), Some(&"the answer"));

Benchmarks

64-bit

Bytes SipHasher (MB/s) XXHash (MB/s) Ratio
1 52 38 73%
4 210 148 70%
16 615 615 100%
32 914 1391 152%
128 1347 3657 271%
256 1414 5019 355%
512 1546 6168 399%
1024 1565 6206 397%
1048576 1592 7564 475%
Bytes FnvHasher (MB/s) XXHash (MB/s) Ratio
1 1000 38 4%
4 800 148 19%
16 761 615 81%
32 761 1391 183%
128 727 3657 503%
256 759 5019 661%
512 745 6168 828%
1024 741 6206 838%
1048576 745 7564 1015%

32-bit

Bytes SipHasher (MB/s) XXHash32 (MB/s) Ratio
1 52 55 106%
4 210 210 100%
16 615 1230 200%
32 914 1882 206%
128 1347 3282 244%
256 1414 3459 245%
512 1546 3792 245%
1024 1565 3938 252%
1048576 1592 4127 259%
Bytes FnvHasher (MB/s) XXHash32 (MB/s) Ratio
1 1000 55 6%
4 800 210 26%
16 761 1230 162%
32 761 1882 247%
128 727 3282 451%
256 759 3459 456%
512 745 3792 509%
1024 741 3938 531%
1048576 745 4127 554%

Contributing

  1. Fork it ( https://github.com/shepmaster/twox-hash/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Add a failing test.
  4. Add code to pass the test.
  5. Commit your changes (git commit -am 'Add some feature')
  6. Ensure tests pass.
  7. Push to the branch (git push origin my-new-feature)
  8. Create a new Pull Request

twox-hash's People

Contributors

shepmaster avatar flier avatar quark-zju avatar zackmdavis avatar aswild avatar blackbeam avatar durch avatar fmckeogh avatar mre avatar tkaitchuck avatar dependabot-preview[bot] 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.