Posts

A new OCaml library: kv-lite, a Key Value store implemented on SQLite

I wrote a thin wrapper round SQLite to implement a simple Key Value store interface. The github repository is  https://github.com/tomjridge/kv-lite The bindings use Lwt for concurrency.  Performance is reasonably good: a batch set of 100k operations completes in about 1.5s. This is not as quick as mini-btree, but SQLite is probably doing a bit more here, and the layers of wrapping probably add some overhead too.

Updates to mini-btree library

Image
The mini-btree library is here:  https://github.com/tomjridge/mini-btree Recently I made some changes. Now, mmap is used throughout, and there is no use of the Lwt monad. So, the interface is somewhat simpler, and the performance is slightly improved (although the performance was already fairly good, we can now achieve about 1M inserts per second).  This work was done while employed by OCamlLabs, so many thanks to them. This library may in the future form part of the irmin/irmin-pack/index library used by Tezos.

New minimal B-tree implementation

Image
 In the last couple of days I wrote a minimal B-tree implementation (based on previous work, of course). The link is here:  https://github.com/tomjridge/mini-btree This B-tree is resistant to write reordering, that is, the block device can reorder writes, and crash, and the B-tree will still function correctly (although obviously some recent operations may not have flushed fully to disk unless you managed a sync before the crash).

New position at OCamlLabs

Just a quick update to announce that from August 2021 I will take up a position as a "Principal Software Engineer" at OCamlLabs  https://ocamllabs.io/  (although I initially interviewed with the French counterpart, Tarides). I will be working, at least initially, on various libraries such as: cactus  https://github.com/mirage/cactus index  https://github.com/mirage/index irmin  https://github.com/mirage/irmin The irmin library provides a git-like database, and is used by clients such as Tezos  https://tezos.com/  for their cryptocurrency systems. I guess initially I will be trying to use my knowledge of B-trees to try to improve the performance of these libraries.  I am very much looking forward to this stage of my career, and very glad to put the mess that is the University of Leicester behind me.

ocamlfind, dune, opam, oh my

Just a short note to record that there are various differences between e.g. dune install, and opam install. Indeed, with the current p0 repo, dune install seems to install the library (which can be seen by ocamlfind and dune installed-libraries commands), but not by opam (which doesn't list any p0_lib package). It is not quite clear to me what the semantics of "dune install" is, and why it differs from "opam install". I get that dune, opam and ocamlfind are all different tools, but it seems strange that "dune install" will install files into the opam switch, but won't install the actual opam package. Another one of life's mysteries I guess.

Continuing bad news from the University of Leicester

Image
I am shortly leaving the University. As with many others, I am bound by a "gagging clause", so unable to report on what is happening here. I can, however, link to reports made by others. Recently, one of the academics in the School of Business resigned, citing a "toxic work environment". The student magazine has reported on this here:  https://leicesterstudent.com/2021/04/13/lecturer-resigns-over-toxic-work-environment-at-university-of-leicester/ Particularly telling is the University response (effectively, staff being bullied by the management are encouraged to "ring a counselling helpline"):

Updated combinator parsing library: P0 (2021 version)

Image
 I updated my minimal monadic/combinator parsing library to specialize to strings, and to remove ineffectual functors. The link is here: https://github.com/tomjridge/p0/blob/master/src/p0_2021.ml