mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
use transient API in benchs
This commit is contained in:
parent
13842375a2
commit
d60b3400fa
1 changed files with 19 additions and 0 deletions
|
|
@ -319,6 +319,24 @@ module Tbl = struct
|
||||||
let module U = MUT_OF_IMMUT(T) in
|
let module U = MUT_OF_IMMUT(T) in
|
||||||
(module U)
|
(module U)
|
||||||
|
|
||||||
|
let hashtrie_mut : type a. a key_type -> (module MUT with type key = a)
|
||||||
|
= fun k ->
|
||||||
|
let (module K), name = arg_make k in
|
||||||
|
let module T = struct
|
||||||
|
let name = sprintf "cchashtrie_mut(%s)" name
|
||||||
|
type key = K.t
|
||||||
|
module M = CCHashTrie.Make(K)
|
||||||
|
type 'a t = {
|
||||||
|
id: CCHashTrie.Transient.t;
|
||||||
|
mutable map: 'a M.t;
|
||||||
|
}
|
||||||
|
let create _ = { id=CCHashTrie.Transient.create(); map=M.empty}
|
||||||
|
let find m k = M.get_exn k m.map
|
||||||
|
let add m k v = m.map <- M.add_mut ~id:m.id k v m.map
|
||||||
|
let replace = add
|
||||||
|
end in
|
||||||
|
(module T)
|
||||||
|
|
||||||
let hamt : type a. a key_type -> (module MUT with type key = a)
|
let hamt : type a. a key_type -> (module MUT with type key = a)
|
||||||
= fun k ->
|
= fun k ->
|
||||||
let (module K), name = arg_make k in
|
let (module K), name = arg_make k in
|
||||||
|
|
@ -339,6 +357,7 @@ module Tbl = struct
|
||||||
; wbt Int
|
; wbt Int
|
||||||
; flat_hashtbl
|
; flat_hashtbl
|
||||||
; hashtrie Int
|
; hashtrie Int
|
||||||
|
; hashtrie_mut Int
|
||||||
; hamt Int
|
; hamt Int
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue