All case studies

Where reduction worked

OpenBSD

Removed SQLite from the base system and wrote a flat-file index instead

The manual-page index needed frequent reads and rare writes, so the project replaced a general database with a purpose-built one and fewer lines to audit.

Removed: SQLite, from the OpenBSD base system. The manual-page index was rewritten as a purpose-built file format, mandoc.db(5), in August 2016; SQLite came out of base on 23 September 2016.

Outcome: 200,000 lines of code less to maintain and 15,000 lines of new code less to audit per year, in the author’s count. The database files halved, lookups roughly doubled, and about 300 lines of “very ugly glue code” left mandoc itself.

The reason it could go is worth more than the number. The index had narrow requirements — frequent reads, rare writes, only at system update and pkg_add time — while SQLite’s strengths are flexible queries, efficient writing and scaling to large data. None of those were being used, and all of them were being kept and audited. Writing the replacement cost just under 2,000 lines, and the trade was not free: updates became much slower (still under half a second) and rebuilds went from 4 seconds to 5.

Source: Ingo Schwarze, Forget reusability, aim for perfection (BSDCan Ottawa) (8 June 2018)