Linked Atomic Random Insert Vector: a thread-safe, self-memory-managed vector with no guaranteed sequential insert.

Overview

Linked Atomic Random Insert Vector

Lariv is a thread-safe, self-memory-managed vector with no guaranteed sequential insert. It internally uses a linked ring buffer, that unlike traditional ring buffers, is growable, and very importantly, it doesn't reallocate the whole buffer as part of the process. It has been born inside the TPR project, and it is designed for storing client connections on TPR servers, which usually are short-lived data that have to be accessed via 128-bits integers. This is basically the dashmap for vectors.

It is recommended to over-budget on the size by quite a lot, at least 50% of the averaged expected occupied size, and ideally 100% or 200%. This is required to keep data contention low, avoid having threads fighting over the available spaces. Reallocations only happen when the algorithm assumes the buffer is kind of full, and this either happens when (a) it is full, or (b) elements aren't actually getting deleted (less than 30% since the last check) and that could and will impact performance. The latter is actually a bug, but I made it a feature and added fancy percentages.

Safety

Miri doesn't complain. If you encounter a bug, open an issue please. I don't think this is battle-tested enough for being production ready, I can't really promise anything. Right now it works on basic scenarios, take a look at the src/tests.rs file and judge it by yourself. I would like people to review the code and fix any bugs that they might spot.

Performance

Very performant, as far as I am aware of. If you have a suggestion for improving performance; I pray you to open a PR please. Right now is on par with dashmap, depending on the day Lariv outperforms dashmap for 2ms and sometimes it's the other way around. However, Lariv's performance is much more stable and predictable, while dashmap is... nuts in comparison. I want that to change. I want to be better than dashmap. Meaningfully better. Period. Note to self: Maybe I can get SIMD somewhere here, idk. I know hashbrown and dashmap do a lot of naughty tricks, I should take notes.

Delta of benchmarks in two different days, same state of the computer (no programs opened, etc)

Lariv

Lariv

Dashmap

Lariv

Conclusion

Right now Lariv is the kind of thing services that require stable latencies would use, like e.g., Zoom, Discord.

You might also like...
Powerful math lib for Vector, Matrix and Quaternion operations

An opinionated, powerful math lib for Vector2, Vector3, Matrix and Quaternion operations Vector2 Add, Sub, Div, Mul, Eq Distance Move towards target a

Powerful math lib for Vector, Matrix and Quaternion operations
Powerful math lib for Vector, Matrix and Quaternion operations

An opinionated, powerful math lib for Vector2, Vector3, Matrix and Quaternion operations Vector2 Add, Sub, Div, Mul, Eq Distance Move towards target a

A HashMap/Vector hybrid: efficient, ordered key-value data storage in Rust.

hashvec A HashVec is a hash map / dictionary whose key-value pairs are stored (and can be iterated over) in a fixed order, by default the order in whi

Type erased vector. All elements have the same type.

Type erased vector. All elements have the same type. Designed to be type-erased as far as possible - most of the operations does not know about concre

Compact, clone-on-write vector and string.

ecow Compact, clone-on-write vector and string. Types An EcoVec is a reference-counted clone-on-write vector. It takes up two words of space (= 2 usiz

The Fast Vector Similarity Library is designed to provide efficient computation of various similarity measures between vectors.
The Fast Vector Similarity Library is designed to provide efficient computation of various similarity measures between vectors.

Fast Vector Similarity Library Introduction The Fast Vector Similarity Library is designed to provide efficient computation of various similarity meas

The first compute-centric vector graphic video game
The first compute-centric vector graphic video game

🕹️ Vong This repository contains source code for the first native use of a compute-centric vector graphics video game, inspired by Pong. ✍️ Authors @

An AI-native lightweight, reliable, and high performance open-source vector database.
An AI-native lightweight, reliable, and high performance open-source vector database.

What is OasysDB? OasysDB is a vector database that can be used to store and query high-dimensional vectors. Our goal is to make OasysDB fast and easy

Rust Vector for large amounts of data, that does not copy when growing, by using full `mmap`'d pages.

Large Vector Rust Vector for large amounts of data, that does not copy when growing, by using full mmap'd pages. Maturity I made ths to learn about mm

Owner
Guillem Jara
Hi, I'm Guillem. I am an enthusiast programmer with deep interest in programming and embedded systems.
Guillem Jara
Thread-safe clone-on-write container for fast concurrent writing and reading.

sync_cow Thread-safe clone-on-write container for fast concurrent writing and reading. SyncCow is a container for concurrent writing and reading of da

null 40 Jan 16, 2023
Vemcache is an in-memory vector database.

Vemcache Vemcache is an in-memory vector database. Vemcache can be thought of as the Redis equivalent for vector databases. Getting Started Prerequisi

Faizaan Chishtie 8 May 21, 2023
Portable linked-list allocator designed for baremetal systems

Palloc Portable linked-list allocator for embedded / baremetal systems. Using the crate Include this in the [dependencies] section of Cargo.toml pallo

Pietro 3 Jan 11, 2022
Learn Rust by writing Entirely Too Many linked lists

Learn Rust by writing Entirely Too Many Linked Lists Read the pretty version at https://rust-unofficial.github.io/too-many-lists/. Building Building r

null 2.4k Jan 3, 2023
A simple thread schedule and priority library for rust

thread-priority A simple library to control thread schedule policies and thread priority. If your operating system isn't yet supported, please, create

Victor Polevoy 62 Dec 5, 2022
A additional Rust compiler pass to detect memory safe bugs of Rust programs.

SafeDrop A additional Rust compiler pass to detect memory safe bugs of Rust programs. SafeDrop performs path-sensitive and field-sensitive inter-proce

Artisan-Lab  (Fn*) 5 Nov 25, 2022
Blazing fast, memory safe & modern Linux package manager written in Rust.

paket Blazing fast, memory safe & modern Linux package manager written in Rust. Roadmap Version: 0.1 Paket.toml file parsing. (#1, #2) CLI handling (p

null 4 Oct 19, 2023
Make a .scratch directory to keep random scribbles in

mkscratch Creates a directory named .scratch in your current working directory which will be ignored by Git. Useful for keeping around miscellaneous f

Kayla 3 Oct 21, 2022
Dataflow system for building self-driving car and robotics applications.

ERDOS ERDOS is a platform for developing self-driving cars and robotics applications. Getting started The easiest way to get ERDOS running is to use o

ERDOS 163 Dec 29, 2022
Serde support for n-dimensional arrays from self-describing formats

serde-ndim Overview This crate provides a way to serialize and deserialize arrays of arbitrary dimensionality from self-described formats such as JSON

Ingvar Stepanyan 5 Apr 3, 2023