mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 03:05:28 -05:00
added arrays to benchs;
updated README
This commit is contained in:
parent
e924d0639a
commit
66f5a97f92
2 changed files with 15 additions and 1 deletions
|
|
@ -13,6 +13,8 @@ structures comprise:
|
||||||
- `Heap`, an imperative heap based on `SplayTree`
|
- `Heap`, an imperative heap based on `SplayTree`
|
||||||
- `Graph`, a polymorphic imperative directed graph (on top of `PHashtbl`)
|
- `Graph`, a polymorphic imperative directed graph (on top of `PHashtbl`)
|
||||||
- `Hashset`, a polymorphic imperative set 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
|
- `FQueue`, a purely functional queue structure
|
||||||
- `Heap`, a purely functional polymorphic heap
|
- `Heap`, a purely functional polymorphic heap
|
||||||
|
|
||||||
|
|
@ -20,7 +22,11 @@ Other structures are:
|
||||||
|
|
||||||
- `Univ`, a universal type encoding with affectation
|
- `Univ`, a universal type encoding with affectation
|
||||||
- `Cache`, a low level memoization cache for unary and binary functions
|
- `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)
|
- `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)
|
- `Vector`, a growable array (pure OCaml, no C; not tested)
|
||||||
- `FlatHashtbl`, a (deprecated) open addressing hashtable with
|
- `FlatHashtbl`, a (deprecated) open addressing hashtable with
|
||||||
a functorial interface (replaced by PHashtbl)
|
a functorial interface (replaced by PHashtbl)
|
||||||
|
|
|
||||||
|
|
@ -217,6 +217,12 @@ let skiplist_find l =
|
||||||
ignore (SkipList.find l i);
|
ignore (SkipList.find l i);
|
||||||
done
|
done
|
||||||
|
|
||||||
|
let array_find a =
|
||||||
|
fun n ->
|
||||||
|
for i = 0 to n-1 do
|
||||||
|
ignore (Array.get a i);
|
||||||
|
done
|
||||||
|
|
||||||
let _ =
|
let _ =
|
||||||
List.iter
|
List.iter
|
||||||
(fun len ->
|
(fun len ->
|
||||||
|
|
@ -227,6 +233,7 @@ let _ =
|
||||||
let h'''' = ifhashtbl_add len in
|
let h'''' = ifhashtbl_add len in
|
||||||
let h''''' = ipersistenthashtbl_add len in
|
let h''''' = ipersistenthashtbl_add len in
|
||||||
let l = skiplist_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 "----------------------------------------@.";
|
||||||
Format.printf "try on size %d@.@.@." len;
|
Format.printf "try on size %d@.@.@." len;
|
||||||
Bench.bench [
|
Bench.bench [
|
||||||
|
|
@ -237,8 +244,9 @@ let _ =
|
||||||
"ifhashtbl_find", (fun () -> ifhashtbl_find h'''' len);
|
"ifhashtbl_find", (fun () -> ifhashtbl_find h'''' len);
|
||||||
"ipersistenthashtbl_find", (fun () -> ipersistenthashtbl_find h''''' len);
|
"ipersistenthashtbl_find", (fun () -> ipersistenthashtbl_find h''''' len);
|
||||||
"skiplist_find", (fun () -> skiplist_find l 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} *)
|
(** {2 Sequence/Gen} *)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue