{"id":13440028,"url":"https://github.com/martinus/map_benchmark","last_synced_at":"2025-09-02T21:50:35.456Z","repository":{"id":37034019,"uuid":"135927185","full_name":"martinus/map_benchmark","owner":"martinus","description":"Comprehensive benchmarks of C++ maps","archived":false,"fork":false,"pushed_at":"2023-04-14T07:42:57.000Z","size":20644,"stargazers_count":309,"open_issues_count":7,"forks_count":29,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-05-26T11:15:52.985Z","etag":null,"topics":["benchmark","c-plus-plus","hashmaps"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/martinus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2018-06-03T17:49:54.000Z","updated_at":"2025-05-01T11:57:01.000Z","dependencies_parsed_at":"2024-02-26T19:47:22.957Z","dependency_job_id":"66afc7ea-ddbd-4a78-a569-8d79a3d8ec9a","html_url":"https://github.com/martinus/map_benchmark","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/martinus/map_benchmark","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinus%2Fmap_benchmark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinus%2Fmap_benchmark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinus%2Fmap_benchmark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinus%2Fmap_benchmark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/martinus","download_url":"https://codeload.github.com/martinus/map_benchmark/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinus%2Fmap_benchmark/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269787312,"owners_count":24475714,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["benchmark","c-plus-plus","hashmaps"],"created_at":"2024-07-31T03:01:19.122Z","updated_at":"2025-08-10T21:03:37.357Z","avatar_url":"https://github.com/martinus.png","language":"C++","funding_links":[],"categories":["HarmonyOS"],"sub_categories":["Windows Manager"],"readme":"# map_benchmark\nComprehensive benchmarks of C++ maps\n\n# Results\n\n[Please see here.](https://martin.ankerl.com/2019/04/01/hashmap-benchmarks-01-overview/)\n\n# building\n\n1. Install dependencies for folly::F14, see https://github.com/facebook/folly/#ubuntu-1604-lts\n1. Install `ninja` and `cmake`\n\n```\ngit clone --recurse-submodules https://github.com/martinus/map_benchmark.git\n./map_benchmark/tools/build.sh\n```\n\n# Updating Submodules\n\n```sh\ngit submodule update --force --remote                                                                                                                                                                                                                                    \n```\n\n# Sourcecode Layout\n\nThe implementation if the benchmark is open source, get it here: [martinus/map_benchmark](https://github.com/martinus/map_benchmark). It is split in several parts:\n\n1. `external`:  all map implementations available through github are added as git submodules here.\n1. `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:\n  ```cpp\n  template \u003cclass Key\u003e\n  using Hash = robin_hood::hash\u003cKey\u003e;\n  ```\n1. `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:\n  ```cpp\n  #include \"Hash.h\"\n  template \u003cclass Key, class Val\u003e\n  using Map = robin_hood::unordered_flat_map\u003cKey, Val, Hash\u003cKey\u003e\u003e;\n  ```\n\n\n# Add a new Hashmap\n\n1. In `external`, add a submodule:\n   ```\n   cd external\n   git submodule add -b master https://github.com/rigtorp/HashMap.git rigtorp__HashMap\n   ```\n2. Create a directory in `src/map/` with a file `Hash.h`. See the others for example.\n\n\n# Maps I couldn't add\n* [QHash](https://github.com/qt/qtbase): It's interface is too different to be easily includeable. e.g. `iterator-\u003efirst` and `iterator-\u003esecond` do not exist.\n* [rigtorp::HashMap](https://github.com/rigtorp/HashMap): Doesn't have a default constructor\n\n\n# Reliable Benchmarks\n\n1. Run `lscpu --extended` to find out if you have hyperthreadding. E.g. for me it shows \n   ```\n   $ lscpu --extended\n   CPU NODE SOCKET CORE L1d:L1i:L2:L3 ONLINE MAXMHZ    MINMHZ\n   0   0    0      0    0:0:0:0       yes    4600,0000 800,0000\n   1   0    0      1    1:1:1:0       yes    4600,0000 800,0000\n   2   0    0      2    2:2:2:0       yes    4600,0000 800,0000\n   3   0    0      3    3:3:3:0       yes    4600,0000 800,0000\n   4   0    0      4    4:4:4:0       yes    4600,0000 800,0000\n   5   0    0      5    5:5:5:0       yes    4600,0000 800,0000\n   6   0    0      0    0:0:0:0       yes    4600,0000 800,0000\n   7   0    0      1    1:1:1:0       yes    4600,0000 800,0000\n   8   0    0      2    2:2:2:0       yes    4600,0000 800,0000\n   9   0    0      3    3:3:3:0       yes    4600,0000 800,0000\n   10  0    0      4    4:4:4:0       yes    4600,0000 800,0000\n   11  0    0      5    5:5:5:0       yes    4600,0000 800,0000\n   ```\n1. Isolate a CPU with it's hyperthreading companion. I'm isolating CPU 5 and 11.\n1. Edit `/etc/default/grub` and change GRUB_CMDLINE_LINUX_DEFAULT so it looks like this:\n   ```\n   GRUB_CMDLINE_LINUX_DEFAULT=\"quiet splash isolcpus=5,11 rcu_nocbs=5,11\"\n   ```\n1. Run `sudo update-grub`\n1. reboot\n1. Edit `bench.rb` so the `taskset -c ...` prefix is correct.\n1. Install Python module `perf`, see https://perf.readthedocs.io/en/latest/\n1. Run `sudo python3 -m perf system tune`\n1. Start the benchmarks: ```../tools/bench.rb |tee ../data/all_new.txt```\n\nSources:\n* https://wiki.ubuntuusers.de/GRUB_2/Konfiguration/\n* https://perf.readthedocs.io/en/latest/system.html","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinus%2Fmap_benchmark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmartinus%2Fmap_benchmark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinus%2Fmap_benchmark/lists"}