Giter Club home page Giter Club logo

ritelinked's Introduction

RiteLinked

HashMap-like containers that hold their key-value pairs in a user controllable order

Latest Version API Documentation

RiteLinked provides more up to date versions of LinkedHashMap & LinkedHashSet . You can easily use it on std or no_std environment.

Support some practical feature combinations to help you better embed them in existing code: serde, inline-more etc. Especially, it uses griddle by default, if you have a lot of data, it can effectively help you reduce the possible tail delay. (Of course, hashbrown can also be used)

Usage

Add ritelinked to Cargo.toml:

ritelinked = "x.y.z"

Write some code like this:

let mut lru_cache = LinkedHashMap::new();
let key = "key".to_owned();
let _cached_val = lru_cache
    .raw_entry_mut()
    .from_key(&key)
    .or_insert_with(|| (key.clone(), 42));

Benchmark

ritelinked              time:   [140.15 ns 141.06 ns 142.15 ns]                       
Found 11 outliers among 100 measurements (11.00%)
  8 (8.00%) high mild
  3 (3.00%) high severe

hashlink                time:   [147.01 ns 147.87 ns 148.75 ns]                     
Found 11 outliers among 100 measurements (11.00%)
  4 (4.00%) high mild
  7 (7.00%) high severe

linked-hash-map         time:   [301.44 ns 309.86 ns 319.40 ns]                            
Found 12 outliers among 100 measurements (12.00%)
  9 (9.00%) high mild
  3 (3.00%) high severe

Credit

It is a fork of the popular crate hashlink, but more adjustments and improvements have been made to the code .

License

This library is licensed the same as hashlink, it is licensed under either of:

at your option.

ritelinked's People

Contributors

psiace avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ritelinked's Issues

Add more docs and comprehensive tests.

RiteLinked is similar to most other implementations such as linked-hash-map & linked-hash-set, but adding more documentation and improving test coverage is still necessary.

Implement missing APIs

The following API should be implemented:

Current expectations

  • Entries API, used by ckb-util
  • rayon support, just like indexmap or griddle
  • compare with linked_hash_set

Need to discuss

  • Some API consistent with the behavior of or_insert and or_insert_with in linked-hash-map

Anyone can implement these by hand, and add relevant discussions below.

Is it a common practice to make one commit mixing the changes with origin codes, when forked other's repository?

ref: datafuselabs/databend#3979

Hi @wangzhen11aaa , this question is about ritelinked, and I think we can open an issue at https://github.com/dataslime/ritelinked .


I'm glad you're interested in ritelinked. ritelinked is derived from hashlink and they share most of the code logic. The main differences are these:

  • some new features, such as amortized, support no_std
  • better maintenance and well organization (eg. ritelinked's serde module was fixed earlier than hashlink)
  • some functions such as get_refresh, retain

see old commit history: https://github.com/dataslime/ritelinked/commits/ritelabs/ritelinked

Also, it is a fact that ritelinked is pretty much my personal hashlink fork, although it is used by some projects. Since I plan to do some rewrites, I overwrite the commit records under the main branch, sorry for the confusion.

Derive Deserialize

I would like to use LinkedHashSet/Map in this struct that I derive Deserialize on:

#[derive(Deserialize, Serialize, Clone)]
pub struct RunState {
    functions: Vec<RuntimeFunction>,
    blocked: LinkedHashSet<usize>,
}

How can I do that without having to write a serializer/deserializer?

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.