I am in the middle of developing a custom persistent Key Value type data structure, to compare against SqlLite and Berkley DB. Anyway before I wrote the implementation I wanted to find the best data structure to use for this purposes. I looked at the a couple:
- An open source redblack tree.
- Mono Dictionary implementation.
I wanted the datastructures I picked to have performance numbers comparable to the .net dictionary.
I used a simple test for loop with 500k iterations for inserts and used the stopwatch to measure inserts and key look up:
I notice that
- Berkley DB key lookup time was about the same as the Dictionary.
- I tried my for loop test for C5 the dictionary, a redblack tree implementation and even mono's dictionary implementation.
Insert time: 7% slower than the .net dictionary.
Lookup time: 1000% slower than the .net dictionary. This is even slower than the look up speed with sqllite!! I attempted to perform the test with compiler optimization turned on and still got similar results.
I realize I am comparing Hashtables vs trees etc, but I stumped as to the performance discrepancy between all the data structures.
Anybody have any ideas