HomePhabricator

Use inverted schema definition for fast loading.

Description

Use inverted schema definition for fast loading.

If we pre-generate the data structure for holding schemas in a way
that is optimized for the way we typically access this information
we can save time on initialization:

Instead of having the schema for a given setting in one array with keys
for the default, type, etc, this puts all defaults into one array, all
types into another array, etc. This allows the default values to be
copied in bulk, without having to iterate over the 700+ settings and
look for a default value in each schema array.

Benchmark results from my laptop: 0.85ms for loading config-schema.php,
that is a 85% improvement over the 6.3ms it took before.
It's even 32% faster than loading DefaultSettings.php, which takes 1.26ms.

Bug: T300129
Change-Id: Id9dd0bff6a6d4b501e74237b5d7198088c38c302

Details

Provenance
danielAuthored on Apr 29 2022, 5:09 PM
tstarlingCommitted on May 6 2022, 2:56 AM
Parents
rMW4ece9d46fed4: Merge "rdbms: Remove db name from error message"
Branches
Unknown
Tags
Unknown
ChangeId
Id9dd0bff6a6d4b501e74237b5d7198088c38c302