We are pleased to announce the first release of Sek, an OCaml library that
offers an efficient implementation of sequences.
The library offers both ephemeral (mutable) sequences and persistent
(immutable) sequences, and offers constant-time conversions between these
flavors.
It supports all of the standard operations on stacks, queues, deques (e.g.
push, pop at either end), catenable sequences (concat, split), and random
access sequences (get, set).
Data is stored internally in chunks (fixed-capacity arrays),
which is why this data structure is known as a chunK SEquence.
It is intended to achieve excellent time complexity and memory usage.
This is an initial release. The library has not been tested in production,
but has received extensive unit testing, via afl-fuzz and ocaml+afl –
which are remarkably effective tools, by the way!
This is work in progress; more features, such as iterators, will be added
in the future.
Exciting stuff! Do you have any benchmarking to compare it to the other sequence libraries out there? I’m particularly interested in how it compares to Base.Sequence and Seq in the OCaml distribution, but surely there are others as well.
Thanks!
Regarding benchmarks: we have preliminary results; they look good; we still need to complete the benchmarks and write text explaining what we are measuring exactly.
+
Arthur
This actually looks like an array/vector structure (supporting, among other things, fast access to the nth element), so a comparison with CCVector, CCFun_vec, BatVect, Clarity.Vector etc. would be more appropriate. The name is a bit unfortunate considering the naming used in the general ecosystem.
Some time ago, I added some crude benchmarks to containers’ benchsuite. I’ll see if I can add Sek when I find time.
I think it really is a sequence library in the sense that in maintains an in-order sequence of items, and sequences can be joined/split efficiently. It also provides logarithmic random access, but this is probably not competitive with fixed-size arrays. It would be comparable to “persistent vector” libraries, ropes, finger trees, etc. The fact that the authors expose a Stack/Queue interface suggests that it has also been tuned to perform reasonably well in this case.
It does not provide any delayed computation of items, so in that regard it is not comparable to Sequence/Seq.
As far as I know, the OCaml implementation just released has not been tested/benchmarked for parallel algorithms. I would be curious to see an experiment of parallel graph traversal with this structure and Multicore-OCaml.