g-andrade

g-andrade

Hi all,

I’m pleased to announce xb5_elixir, a wrapper of xb5, providing B-tree (order 5) alternatives to OTP’s gb_trees and gb_sets, as well as a multiset with order-statistic operations.

If you need ordered collections, xb5 benchmarks show 1.2–2.5× faster execution compared to the OTP modules for most operations, and equal or lower heap usage.

The three Elixir modules are:

  • Xb5.Bag - ordered multiset with order-statistic O(log n) operations (rank, access by index, percentile)

  • Xb5.Set - ordered set, alternative to gb_sets

  • Xb5.Tree - ordered key-value store, alternative to gb_trees

Performance

The underlying Erlang modules were benchmarked together with gb_sets and gb_trees on two separate computers. All tests ran across three build types, and collection sizes from 0 through 15,000.

Two interactive performance reports are published:

Benchmarking code and raw data are available in the xb5_benchmark repo.


https://github.com/g-andrade/xb5_elixir

Showing Posts 1 to 3

Asd

Asd

Wow, very good library. I did some benchmarks against maps and found that xb5 is slower than maps for put, but slightly faster for get and many times faster for conversion to ordered list

However, I find separate repo for benchmarks a little overengineered, given that I was able to reproduce your results with Benchee in like 10 minutes or so.

g-andrade

g-andrade OP

Thank you @Asd! Map is generally faster at mutations and lookups - potentially much faster as collection size grows. Trees are useful when it’s a requirement to have the data sorted at all times with scalable performance.

Regarding benchmarks, I did use Benchee for a long time but struggled to get stable performance curves covering a wide range of collection sizes (0 to 15k) for the same test (the graphs on the report), or getting consistent results across runs without very long warm up times (and even then).

I solved this with a custom benchmarking framework that maximizes CPU cache pressure while keeping testing conditions overall uniform for all the cases, and that runs repeatedly until some semblance of stability has been achieved instead of running for a fixed amount of time. To be honest, a lot of the work in this project went into benchmarking alone.

Asd

Asd

I think that you should add GitHub - discord/sorted_set_nif: Elixir SortedSet backed by a Rust-based NIF · GitHub to your benchmarks. I assume that NIF will be just a little bit faster, which is a huge win for you

Again, congratulations on the initial release. Very solid work. I am definitely going to use it in my projects!

— All posts loaded —

Where Next? Top

Trending in Announcing Top

bluzky
You may know https://ui.shadcn.com/, a UI component library for React. I really love it’s design style and components. I’ve built some co...
387 15136 120
New
wojtekmach
Hey everyone! Req is an HTTP client for Elixir that I’ve been working on for quite some time. There is already a lot of HTTP clients out...
New
handnot2
Samly can be used to enable SAML 2.0 Single Sign On in a Plug/Phoenix application. This library uses Erlang esaml to provide plug enabl...
New
woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New
restlessronin
The repo is at GitHub - cyberchitta/openai_ex: Community maintained Elixir library for OpenAI API · GitHub. Docs are at OpenaiEx User Gu...
152 11030 135
New
shahryarjb
The Chelekom project is a library of Phoenix and LiveView components generated via Mix tasks to fit developer needs seamlessly. One of i...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New

Other Trending Topics Top

mudasobwa
I am seeing a lot of aplications of Argumentum ad Vericundiam in software discussions. They do link some piece of writing and point us to...
New
bartblast
Hey folks, I just published a post about Hologram’s funding and where the project goes next - the short version: Curiosum as Main Spons...
New
alexslade
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog It says that Fly is going all-in on sprites, which is a worry ...
New
Herve37
We’re evaluating API mocking tools for OpenAPI-based projects and would love to hear what other teams are using. We’re particularly inte...
New
sorenone
Today we’re releasing Oban for Python. Not an Oban client in Python. Not a pythonx wrapper embedded in Elixir. Nope, it’s a fully operati...
New
lawik
I was thinking since Goatmire Elixir turned out pretty good I should maybe do another one. 30th of Sep - 2nd of Oct this year./ The firs...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews