aboutsummaryrefslogtreecommitdiff
path: root/lib/pp.ml
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2017-02-16 12:26:13 +0100
committerPierre-Marie Pédrot2017-02-19 20:11:50 +0100
commit2b8ad7e04002ebe9fec5790da924673418f2fa7f (patch)
treeb758d62d16e90d05fa56516fed81604c8d873ac3 /lib/pp.ml
parent7707396c5010d88c3d0be6ecee816d8da7ed0ee0 (diff)
Optimizing array mapping in the kernel.
We unroll the map operation by hand in two performance-critical cases so as not to call the generic array allocation function in OCaml, and allocate directly on the minor heap instead. The generic array function is slow because it needs to discriminate between float and non-float arrays. The unrolling replaces this by a simple increment to the minor heap pointer and moves from the stack. The quantity of unrolling was determined by experimental measures on various Coq developments. It looks like most of the maps are for small arrays of size lesser or equal to 4, so this is what is implemented here. We could probably extend it to an even bigger number, but that would result in ugly code. From what I've seen, virtually all maps are of size less than 16, so that we could probably be almost optimal by going up to 16 unrollings, but the code tradeoffs are not obvious. Maybe when we have PPX?
Diffstat (limited to 'lib/pp.ml')
0 files changed, 0 insertions, 0 deletions