public
Description: Imperative and functional finite map implementations, head to head
Homepage:
Clone URL: git://github.com/mfp/ocaml-finite-maps.git
name age message
file .gitignore Fri Jun 19 02:56:29 -0700 2009 Imported code. [mfp]
file OMakefile Fri Jun 19 03:46:16 -0700 2009 Remove extlib dependency. [mfp]
file OMakeroot Fri Jun 19 02:56:29 -0700 2009 Imported code. [mfp]
file README Fri Jun 19 04:14:02 -0700 2009 README: forgot Map. [mfp]
file benchmark.ml Fri Jun 19 03:46:16 -0700 2009 Remove extlib dependency. [mfp]
directory corpora/ Fri Jun 19 03:12:47 -0700 2009 Include corpora instead of relying on them bein... [mfp]
file fasthashtbl.ml Fri Jun 19 03:03:43 -0700 2009 Copyright attributions. [mfp]
file hashtbl_hval.ml Fri Jun 19 02:56:29 -0700 2009 Imported code. [mfp]
file hashtbl_hval.mli Fri Jun 19 02:56:29 -0700 2009 Imported code. [mfp]
file hashtbl_mod.ml Fri Jun 19 02:56:29 -0700 2009 Imported code. [mfp]
file hashtbl_mod.mli Fri Jun 19 02:56:29 -0700 2009 Imported code. [mfp]
file size.ml Fri Jun 19 02:56:29 -0700 2009 Imported code. [mfp]
file size.mli Fri Jun 19 02:56:29 -0700 2009 Imported code. [mfp]
file ternary.ml Fri Jun 19 03:03:43 -0700 2009 Copyright attributions. [mfp]
file ternary.mli Fri Jun 19 02:56:29 -0700 2009 Imported code. [mfp]
file trie_map.ml Fri Jun 19 03:03:43 -0700 2009 Copyright attributions. [mfp]
file trie_map.mli Fri Jun 19 03:03:43 -0700 2009 Copyright attributions. [mfp]
file trie_map_mod.ml Fri Jun 19 03:03:43 -0700 2009 Copyright attributions. [mfp]
README
Several finite map implementations in OCaml, head to head.

Functional
----------

Trie_map: TST with coalesced constructor for nodes with and without values
Trie_map_mod: TST with different constructors for leaves and inner nodes with
              a value
Ternary: TST with separate constructor for nodes with and without values
         but no leaf constructor
Map: the Map implementation from INRIA's stdlib (AVL tree)


Imperative
----------

Fasthashtbl: hash table with open addressing and double hashing
Hashtbl: the hash table from INRIA's stdlib (external chaining)
Hashtbl_mod: Hashtbl with more aggressive resizing (lower load factor)
Hashtbl_hval: Hashtbl_mod with caching of the hash value

Requirements
============
* OMake
* OCaml (any version should do)

Compiling and running
=====================

$ omake

$ ./benchmark -help

  -n N    Number of iterations (default: 3)
  -s      Show structure sizes.
  -help   Display this list of options
  --help  Display this list of options

$ ./benchmark -n 10
String set size: 98568
Target array 1: 217625
Target array 2: 86016

Fasthashtbl:
 ints
  add                                    0.18055s  (1205378 / sec)
 struct size: 11124672
  find (constant w/ overhead)            0.02775s  (36040042 / sec)
  find (constant, no overhead)           0.02312s  (43250748 / sec)
...