package obatcher
A Framework for building Batched Concurrent Data Structures
Install
Dune Dependency
Authors
Maintainers
Sources
obatcher-1.1.tbz
sha256=2ee8f97a1e4a55899f8fdc48aa422e553d6a4d256e71b59e4257448beaf27dd3
sha512=61d0645dc5bd6955f3e663f133d27d9c8c61081e24bc8d88e73f86380432e783fa50bc4d980a9b17ccb949f6af9b90ef834f379ec9171b692745f05d9a34c0f9
doc/src/obatcher.ds/batched_hashtbl.ml.html
Source file batched_hashtbl.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
(* Flat-combining hashtable, with no fancy internal parallelism *) open Picos module Batched = struct type t = (int, string) Stdlib.Hashtbl.t type 'a op = | Add : int * string -> unit op | Replace : int * string -> unit op | Remove : int -> unit op | Find : int -> string op type wrapped_op = Mk : 'a op * 'a Computation.t -> wrapped_op type cfg = { random : bool option; initial_size : int } let init ?(cfg = { random = None; initial_size = 0 }) () = Stdlib.Hashtbl.create ?random:cfg.random cfg.initial_size let run t (batch : wrapped_op array) = Array.iter (function | Mk (Add (k, v), comp) -> Computation.return comp (Stdlib.Hashtbl.add t k v) | Mk (Replace (k, v), comp) -> Computation.return comp (Stdlib.Hashtbl.replace t k v) | Mk (Remove k, comp) -> Computation.return comp (Stdlib.Hashtbl.remove t k) | Mk (Find k, comp) -> Computation.return comp (Stdlib.Hashtbl.find t k)) batch end (* Set up implicit batching *) include Obatcher.Make (Batched)
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>