package fix

  1. Overview
  2. Docs
Algorithmic building blocks for memoization, recursion, and more

Install

Dune Dependency

Authors

Maintainers

Sources

archive.tar.gz
md5=75aeb28e58d5a2c8b8c2590d23d1122d
sha512=744b08403beb22d8d960976792dd2f80ee9b47c9b3d3977d98e09aa127c3e21531acb305ab42c734ad1067b0ababa43b251afd3e111d296e3b07fbe2c187b082

doc/fix/Fix/CompactQueue/index.html

Module Fix.CompactQueueSource

This module offers a minimalist mutable FIFO queue that is tuned for performance.

In comparison with OCaml's Queue module, it uses a more compact internal representation: elements are stored contiguously in an array. This has a positive impact on performance: both time and memory consumption are reduced.

The implementation is optimized for maximum throughput. The internal array is never shrunk, so a queue that has contained many elements in the past remains large. Furthermore, array slots are not overwritten when elements are extracted; thus, an element that has appeared in the queue in the past can remain reachable. These drawbacks are usually acceptable provided that the queue is thrown away after use.

Sourcetype 'a t

The type of a queue.

Sourceval create : unit -> 'a t

create() creates an empty queue.

Sourceval is_empty : 'a t -> bool

is_empty q tests whether the queue q is empty.

Sourceval add : 'a -> 'a t -> unit

add x q adds the element x at the end of the queue q.

Sourceexception Empty

Empty is raised when take is applied to an empty queue.

Sourceval take : 'a t -> 'a

take q removes and returns the first element of the queue q. It raises Empty if the queue is empty.

OCaml

Innovation. Community. Security.