I thought I'd do a writeup of the process of implementing and
optimizing one of the graph metrics in Dgraph, starting from a
fairly straight copy of pseudo-code in a research paper all
through the various incremental tweaks that improve performance.
I guess the optimizations made in this process are trivial for
anyone experienced in D, but I hope the detailed description of
what changes produce useful speedups might be useful for people
new to the language.