Coder Social home page Coder Social logo

cpp-rrb's Introduction

cpp-rrb

C++ port of Jean Niklas L'orange's RRB-tree implementation

Relaxed Radix Balanced trees (RRB-trees) are immutable data structures with good performance for all vector-like operations, including insertion, erasion, and concatenation.

This implementation is a C++ port of the library c-rrb, with the following modifications:

  • Garbage collection (Boehm GC) has been replaced by reference counting.
  • The original c-rrb implementation stores objects in the rrb-tree as boxed objects (i.e. pointers). Here we store them unboxed (as values sequentially in memory per tree node).

The main data structure has three template parameters:

  template <typename T, bool atomic_ref_counting, int N>
  struct rrb;  

The first parameter T is the type of the elements. The second parameter bool atomic_ref_counting indicates whether the reference counting should be thread-safe or not. If false and thus not thread-safe, the performance is faster. The third parameter int N indicates the branching factor of the tree. The default is 5, which corresponds to a branching factor of 2^5.

The usage of the rbb tree has been wrapped in a more familiar vector-like structure:

  template <typename T, bool atomic_ref_counting, int N>
  class vector;

similar to immer::flex_vector of the library immer.

This library has been tested on Windows 10 using Visual Studio 2017/2019, on Ubuntu 18.04.4 with gcc 7.5.0, and on MacOS 10.15.6 with XCode 11.7. You best use CMake to generate a solution file or makefile or XCode project.

For a practical application, see my jedi project: a minimalist text editor inspired by Acme and Nano.

cpp-rrb's People

Contributors

janm31415 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 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.