This is a follow-up of my previous post. Here I change the table to several charts. Hope it seems more friendly to readers. You can find the links to these libraries in that table. Their source codes, including my testing code, are available here. You may also want to see my previous posts in the [...]
Posts Tagged ‘programming’
Another Look at my old Benchmark
Posted in development, tagged benchmark, C, cpp, myprog, programming on October 7, 2008 | 24 Comments »
Futher Discussion on Search Trees
Posted in development, tagged benchmark, C, cpp, myprog, programming on September 28, 2008 | Leave a Comment »
Over the weekend, I have done a more comprehensive benchmark of various libraries on search trees. Two AVL, seven red-black tree, one Splay tree, two treap implementations are involved, together with seven hash table libraries. As I need to present a big table, I have to write it in a free-style HTML page. You can [...]
B-tree vs. Binary Search Tree
Posted in development, tagged C, myprog, programming on September 24, 2008 | 18 Comments »
When talking about in-memory search tree, we usually think of various binary search trees: red-black tree, AVL tree, treap, splay tree and so on. We do not often think of B-tree, as B-tree is commonly introduced as an on-disk data structure rather than in-memory one. Is B-tree also a good data structure for in-memory ordered [...]
A Simple Generic Vector Container in C
Posted in development, tagged C, macro, myprog, programming on September 22, 2008 | 3 Comments »
I do not see much need to have a vector container in C as a vector is simply an array and array operations are all very simple. Nontheless, it might still better to implement one, for the sake of completeness. Here is the code. The library is almost as fast as the fastest code you [...]
Thoughts on Generic Programming in C
Posted in development, tagged C, cpp, programming, thinking on September 21, 2008 | 1 Comment »
I came across two interviews (here and here) of Alexander Stepanov, the father of STL. There are quite a lot of interesting bits. For example, he thinks C++ is the best programming language to realize his goal, but he is also strongly against OOP at the same time. In addition, he has paid a lot [...]
Calculating Median
Posted in development, tagged algorithm, C, myprog, programming on September 13, 2008 | Leave a Comment »
Here is an example that google does not give me the result in the first page. I want to know how to calculate median efficiently, and so I search “c calculate median”. In the first result page, google brings me to several forums which only show very naive implementations. The 11th result, this page, is [...]
The Google Dense Hashtable Library
Posted in development, tagged hash, programming on September 12, 2008 | Leave a Comment »
Google dense hash table (google-dense) implements an open addressing hash table with quardric probing. It requires users to set an empty element and a deleted element which are distinct from all the other valid keys in the hash table. Google-dense tests whether a bucket is empty or deleted by performing key comparisons. It is fast [...]
Implementing Generic Hash Library in C
Posted in development, tagged C, hash, myprog, programming on September 2, 2008 | 9 Comments »
Synopsis
Here is an simple example showing how to use khash.h library:
#include "khash.h"
KHASH_MAP_INIT_INT(32, char)
int main() {
int ret, is_missing;
khiter_t k;
khash_t(32) *h = kh_init(32);
k = kh_put(32, h, 5, &ret);
if (!ret) kh_del(32, h, k);
kh_value(h, k) = 10;
k = kh_get(32, h, 10);
is_missing = (k == kh_end(h));
k = kh_get(32, h, 5);
kh_del(32, h, k);
for (k = kh_begin(h); k != kh_end(h); ++k)
if (kh_exist(h, [...]
Generic Programming in C
Posted in development, tagged C, programming on September 2, 2008 | 4 Comments »
Template in C++ is the single reason that I still keep using it. Previously, I thought generic programming in C is nothing but ugly and painful. Now I have changed my mind a bit, in the light of tree.h written by Niels Provos. Generic programming in C can be done without much pain and with [...]
Comparison of Hash Table Libraries
Posted in development, tagged benchmark, C, cpp, hash, myprog, programming on August 28, 2008 | 25 Comments »
As a Perl programmer, I enjoy a lot using hash tables. I keep this habit in C/C++ programming. Then what C/C++ hash libraries are available? How are they compared to each other? In this post, I will give a brief review of hash libraries and present a small benchmark showing their practical performance.
Hash table libraries
In [...]