boltdb/bolt — pull request #169 by benbjohnson (2014-05-19 18:13:19+00:00)
Title: Fix freelist allocation direction.

## Overview

This commit fixes the freelist so that it frees from the beginning of the data file instead of the end. It also adds a fast path for pages which can be allocated from the first free pages and it includes read transaction stats.

# History

The freelist code was originally ported from LMDB which used a reverse sorted pgid list. It was traverse backwards over the list which would, in turn, allocate pages from the beginning of the data file. During the port, the reverse sorting was kept but it was iterated in forward order which meant that pages were getting allocated off the end of the data file.

/cc @snormore @mkobetic