[glass] Elide component_of counter in first leaf
commit47ae63177ab911abe5b8cd2133d307fb4a78e94b
authorOlly Betts <olly@survex.com>
Tue, 15 Mar 2016 03:46:21 +0000 (15 16:46 +1300)
committerOlly Betts <olly@survex.com>
Tue, 15 Mar 2016 03:58:47 +0000 (15 16:58 +1300)
treee94872a3f6b6c7e4c52179ee71a859b60096568a
parent6cd7c004fef0cb9ffeddf6e3f96613e15c72540a
[glass] Elide component_of counter in first leaf

Store a "first component" flag in the flag bits of item - when set we
know this is the first component and so we don't need to store X2.  This
directly saves 2 bytes per entry in the Btree, plus additional space due
to fewer blocks and fewer levels being needed as a result.  This
particularly helps the position table, which has a lot of entries, many
of them very small.  The saving would be expected to be a little less
than the saving from the change which shaved 2 bytes of every Btree item
in 1.3.4, since we're only shaving 2 bytes off every *entry* (an entry
with a large tag may be split into multiple items), and a simple test
suggests a saving of several percent in total DB size, which fits that.

This reduces the maximum component size to 8191, which affects tables
with a 64KB blocksize in normal use and tables with >= 16KB blocksize
with full compaction.
xapian-core/backends/glass/glass_table.cc
xapian-core/backends/glass/glass_table.h
xapian-core/backends/glass/glass_version.cc