View in context in the libbitcoin Slack #general mirror.
mmap refactor incoming. Our mmap wrapper (map) is now a variadic template (more compile time yay), factored from one into four source files...
github.com/libbitcoin/libbitcoin-database/pull/847/changes
The rather large interface is unchanged, not test impact. There is just a template parameter for table widths, with the default being one column of width 1 (map<1>). This reduces to the identical compiled code as the previous map class. But now we can define an map as map<4, 32, 33, 64> (our ecdsa signature table). Under the covers there are four mmaps of specified columns and an aligned number of rows. The single map has all of the same logical and physical size values and methods, aggregating the tables.
This is similar to what I did previously, but that maintained the full map object for each table. So that meant all guards applied to each table independently. All allocator locks and remaps were independent. This reduces that to the one set of controls just spread over the independent mmap files. So the type changes trivially for a SoA table, the constructor accepts the corresponding number of file system paths, and divides up the numeric config across the columns.
And there is an accessor that allows the stream read/write in logical tables to obtain the offset pointer the specific columns. So that is buried in the existing logical table wrapper object for the vertical tables, so that the columns are sub-named. If this doesn't bring the perf back into line with horizontal rows, I'll be sad, because the impl is pretty slick - and there's really nothing else to optimize.