mackstann / hash-table-shootout Goto Github PK
View Code? Open in Web Editor NEWA benchmark of some prominent C/C++ hash table implementations
A benchmark of some prominent C/C++ hash table implementations
How to run these benchmarks: First, some prerequisites are: * make * gcc and recent g++ (4.3-ish?) * python (hard-coded for 2.6 -- edit Makefile to use another version) * glib * boost * google sparsehash * qt Now, run: $ make $ python bench.py $ python make_chart_data.py < output | python make_html.py Your charts are now in charts.html. You can tweak some of the values in bench.py to make it run faster at the expense of less granular data, and you might need to tweak some of the tickSize settings in charts-template.html. To run the benchmark at the highest priority possible, do this: $ sudo nice -n-20 ionice -c1 -n0 sudo -u $USER python bench.py You might also want to disable any swap files/partitions so that swapping doesn't influence performance. (The programs will just die if they try to allocate too much memory.) Copyright Information ===================== Written by Nick Welch in 2010. No copyright. This work is dedicated to the public domain. For full details, see http://creativecommons.org/publicdomain/zero/1.0/
I was reading a blog on benchmarking hashtables. I wonder if cuckoomap can be included as well?
Hi,
Great work!
I test it on my platform, and google_dense_hash_map is the fastest one. But it is a little bit misleading. When we use const char *
as the key type, google_dense_hash_map
doesn't look at the content of string, just comparing pointers, that is one reason why it is so fast, but semantic is wrong, for example,
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <iterator>
#include <functional>
#include <deque>
using namespace std;
#include <google/dense_hash_map>
int main(int argc, char *argv[])
{
typedef google::dense_hash_map<const char *, int64_t> str_hash_t;
str_hash_t str_hash; str_hash.set_empty_key(""); str_hash.set_deleted_key("d");
const char * key;
key = strdup("hello");
str_hash.insert(str_hash_t::value_type(key, 1));
key = strdup("hello");
str_hash.insert(str_hash_t::value_type(key, 2));
for( str_hash_t::iterator i = str_hash.begin();
i != str_hash.end();
++i){
cout << i->first << ":" << i->second << endl;
}
return 0;
}
compile it and run it
g++ -ggdb mytest.cc && ./a.out
hello:1
hello:2
we can see the strings hello
have different address, but google_dense_hash_map<const char*, int> regards them as two distinct keys.
If google_dense_hash_map<const char*,int>
doesn't invoke something like strcmp
, it will be faster.
I try google_dense_hash_map<string, int>
which gives the right answer. but it doesn't fit your testing framework.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.