• Stars
    star
    294
  • Rank 141,303 (Top 3 %)
  • Language
    C++
  • License
    MIT License
  • Created over 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Comprehensive benchmarks of C++ maps

map_benchmark

Comprehensive benchmarks of C++ maps

Results

Please see here.

building

  1. Install dependencies for folly::F14, see https://github.com/facebook/folly/#ubuntu-1604-lts
  2. Install ninja and cmake
git clone --recurse-submodules https://github.com/martinus/map_benchmark.git
./map_benchmark/tools/build.sh

Updating Submodules

git submodule update --force --remote                                                                                                                                                                                                                                    

Sourcecode Layout

The implementation if the benchmark is open source, get it here: martinus/map_benchmark. It is split in several parts:

  1. external: all map implementations available through github are added as git submodules here.
  2. src/hashes: One directory for each hashing algorithm, each directory contains a Hash.h which basically contains a using instruction for the hash, e.g. like this:
template <class Key>
using Hash = robin_hood::hash<Key>;
  1. src/maps: One directory for each unordered map implementation, each directory contains a Map.h which basically contains a using instruction for the map. It includes Hash.h. E.g. like this:
#include "Hash.h"
template <class Key, class Val>
using Map = robin_hood::unordered_flat_map<Key, Val, Hash<Key>>;

Add a new Hashmap

  1. In external, add a submodule:
    cd external
    git submodule add -b master https://github.com/rigtorp/HashMap.git rigtorp__HashMap
    
  2. Create a directory in src/map/ with a file Hash.h. See the others for example.

Maps I couldn't add

  • QHash: It's interface is too different to be easily includeable. e.g. iterator->first and iterator->second do not exist.
  • rigtorp::HashMap: Doesn't have a default constructor

Reliable Benchmarks

  1. Run lscpu --extended to find out if you have hyperthreadding. E.g. for me it shows
    $ lscpu --extended
    CPU NODE SOCKET CORE L1d:L1i:L2:L3 ONLINE MAXMHZ    MINMHZ
    0   0    0      0    0:0:0:0       yes    4600,0000 800,0000
    1   0    0      1    1:1:1:0       yes    4600,0000 800,0000
    2   0    0      2    2:2:2:0       yes    4600,0000 800,0000
    3   0    0      3    3:3:3:0       yes    4600,0000 800,0000
    4   0    0      4    4:4:4:0       yes    4600,0000 800,0000
    5   0    0      5    5:5:5:0       yes    4600,0000 800,0000
    6   0    0      0    0:0:0:0       yes    4600,0000 800,0000
    7   0    0      1    1:1:1:0       yes    4600,0000 800,0000
    8   0    0      2    2:2:2:0       yes    4600,0000 800,0000
    9   0    0      3    3:3:3:0       yes    4600,0000 800,0000
    10  0    0      4    4:4:4:0       yes    4600,0000 800,0000
    11  0    0      5    5:5:5:0       yes    4600,0000 800,0000
    
  2. Isolate a CPU with it's hyperthreading companion. I'm isolating CPU 5 and 11.
  3. Edit /etc/default/grub and change GRUB_CMDLINE_LINUX_DEFAULT so it looks like this:
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash isolcpus=5,11 rcu_nocbs=5,11"
    
  4. Run sudo update-grub
  5. reboot
  6. Edit bench.rb so the taskset -c ... prefix is correct.
  7. Install Python module perf, see https://perf.readthedocs.io/en/latest/
  8. Run sudo python3 -m perf system tune
  9. Start the benchmarks: ../tools/bench.rb |tee ../data/all_new.txt

Sources:

More Repositories

1

robin-hood-hashing

Fast & memory efficient hashtable based on robin hood hashing for C++11/14/17/20
C++
1,510
star
2

nanobench

Simple, fast, accurate single-header microbenchmarking functionality for C++11/14/17/20
C++
1,398
star
3

unordered_dense

A fast & densely stored hashmap and hashset based on robin-hood backward shift deletion
C++
870
star
4

svector

Compact SVO optimized vector for C++17 or higher
C++
94
star
5

BitcoinUtxoVisualizer

Visualize Bitcoin UTXO set
C++
42
star
6

programming-font-test-pattern

Test pattern for programming fonts
38
star
7

better-faster-stronger-mixer

Testing framework for the quest to find a fast & strong mixer, e. g for hashtables.
C++
35
star
8

differential-evolution-rs

Generic Differential Evolution for Rust
Rust
18
star
9

YaceReloaded

Yet Another Corewar Evolver - It's been 12 years, now I'll try my luck again.
Red
9
star
10

base58

A fast implementation of base58 encoding
C++
7
star
11

keto-calculator

keto calculator on the web
HTML
5
star
12

ninja2wctr

Calculates Wall Clock Time Responsibility for each output from .ninja_log
C++
4
star
13

cpp_rng

C++ implementation of random number generators
C++
4
star
14

java-playground

Lots of small java features
Java
3
star
15

exMARS

exMARS - Exhaust Memory Array Redcode Simulator
C
3
star
16

parallel_hashmap_benchmark

simple benchmark of parallel hash maps in C++
C++
3
star
17

bitcoin-stuff

Helpful script, documentation, etc for my bitcoin development
Ruby
3
star
18

bitcoin-utxo-visualizer-rs

Bitcoin UTXO Visualizer in Rust
Rust
3
star
19

gra

Git Repo Admin
Python
2
star
20

tacho

An experimental python tool to measure process runtimes
Python
2
star
21

Bench

Microbenchmark facility for C++. Very simple to use, single header only, with sound statistics.
C++
2
star
22

wordle

C++
1
star
23

brainwallet.rb

Ruby app for brainwallets
Ruby
1
star
24

bunter

colorizes program output, making it 'bunter'
1
star
25

qmars

QMars stands for Quicker Mars. It is a completely new implementation of a mars simulator
C++
1
star
26

rust-ninja-progressbar

Progressbar for Ninja written in Rust
Rust
1
star