added arrays to benchs;

updated README
This commit is contained in:
Simon Cruanes 2013-04-05 17:19:47 +02:00
parent e924d0639a
commit 66f5a97f92
2 changed files with 15 additions and 1 deletions

View file

@ -13,6 +13,8 @@ structures comprise:
- `Heap`, an imperative heap based on `SplayTree`
- `Graph`, a polymorphic imperative directed graph (on top of `PHashtbl`)
- `Hashset`, a polymorphic imperative set on top of `PHashtbl`
- `LazyGraph`, a lazy graph structure on arbitrary (hashable+eq) types, with
basic graph functions that work even on infinite graphs, and printing to DOT.
- `FQueue`, a purely functional queue structure
- `Heap`, a purely functional polymorphic heap
@ -20,7 +22,11 @@ Other structures are:
- `Univ`, a universal type encoding with affectation
- `Cache`, a low level memoization cache for unary and binary functions
- `PersistentHashtbl`, a semi-persistent hashtable (similar to
[persistent arrays](https://www.lri.fr/~filliatr/ftp/ocaml/ds/parray.ml.html))
- `Deque`, an imperative double ended FIFO (double-linked list)
- `Future`, a set of tools for preemptive threading, including a thread pool,
monadic futures, and MVars (concurrent boxes)
- `Vector`, a growable array (pure OCaml, no C; not tested)
- `FlatHashtbl`, a (deprecated) open addressing hashtable with
a functorial interface (replaced by PHashtbl)

View file

@ -217,6 +217,12 @@ let skiplist_find l =
ignore (SkipList.find l i);
done
let array_find a =
fun n ->
for i = 0 to n-1 do
ignore (Array.get a i);
done
let _ =
List.iter
(fun len ->
@ -227,6 +233,7 @@ let _ =
let h'''' = ifhashtbl_add len in
let h''''' = ipersistenthashtbl_add len in
let l = skiplist_add len in
let a = Array.init len (fun i -> string_of_int i) in
Format.printf "----------------------------------------@.";
Format.printf "try on size %d@.@.@." len;
Bench.bench [
@ -237,8 +244,9 @@ let _ =
"ifhashtbl_find", (fun () -> ifhashtbl_find h'''' len);
"ipersistenthashtbl_find", (fun () -> ipersistenthashtbl_find h''''' len);
"skiplist_find", (fun () -> skiplist_find l len);
"array_find", (fun () -> array_find a len);
])
[10;20;100;1000;10000;100000]
[10;20;100;1000;10000]
(** {2 Sequence/Gen} *)