\Drupal\strata\Codec CodecCatalog

The shipped reference figures for every codec, and how to install the ones that are missing.

Where the numbers come from: a fixed 6,357,223-byte corpus of Drupal-shaped data - 1,000 node images in toArray() shape, 1,000 user images carrying JSON field values, and 4,000 custom-table rows including hashed API tokens. Split into frames, each frame compressed independently - which is what Strata actually does - with a zstd dictionary trained on 5% of the frames. Measured on PHP 8.5.7, arm64, with ext-zstd 0.18.0 and ext-brotli 0.21.0.

What the numbers say, at 16 KiB frames, which is the shipped default:

codec level dict ratio compress decompress
none - - 1.00x 18,948 MB/s -
gzip 1 no 3.84x 180.6 MB/s 589.8 MB/s
gzip 9 no 4.40x 67.0 MB/s 589.8 MB/s
zstd 1 no 4.28x 422.9 MB/s 640.3 MB/s
zstd 1 yes 4.67x 105.1 MB/s 640.3 MB/s
zstd 19 no 4.87x 4.5 MB/s 640.3 MB/s
zstd 19 yes 5.86x 2.4 MB/s 640.3 MB/s
brotli 11 no 5.24x 1.1 MB/s 461.6 MB/s
brotli 11 yes 6.07x 0.9 MB/s 461.6 MB/s

Three things follow, and they are why the defaults are what they are:

  • zstd level 1 is the flush-path choice. 4.28x at 422.9 MB/s against gzip level 9's 4.40x at 67.0 MB/s: a fraction worse on size for more than six times the throughput, on a path that runs inside a web request.
  • A dictionary costs throughput, not just disk. At level 1 it takes 422.9 MB/s down to 105.1 MB/s for 4.28x to 4.67x. Whole-batch measurement hides this, because the dictionary is loaded once there and per frame here. It is used during compaction, where 5.86x against 4.87x is worth 2.4 MB/s, and by delta coding, which cannot work without it.
  • brotli wins on size and loses on time. 6.07x is the best figure here, at 0.9 MB/s. That is a compaction codec on a large site and nothing else.

What they do not say: ratio depends on content. This corpus includes incompressible hashed tokens, so it runs low against a prose-heavy site and high against one storing mostly media. These figures exist so two hosts can be compared and so a size estimate has somewhere to start; Calibrator measures the real thing on real site data and the settings form shows both, marking which is which.

Summary

Methods
Properties
Constants
profiles
profile
labels
summaries
install
documentation
referenceMeasurements
No public properties found
No public constants found
No protected methods found
No protected properties found
No protected constants found
No private methods found
No private properties found
No private constants found

Methods

profiles()

profiles(\Drupal\strata\Codec\CodecRegistry  $registry) : list<\Drupal\strata\Codec\CodecProfile>

Builds a profile for every codec a registry knows about.

Parameters

\Drupal\strata\Codec\CodecRegistry $registry

The registry to read availability from.

Returns

list<\Drupal\strata\Codec\CodecProfile> —

Profiles in write-preference order, available codecs first.

profile()

profile(\Drupal\strata\Codec\CodecRegistry  $registry, string  $id) : \Drupal\strata\Codec\CodecProfile

Builds one profile.

Parameters

\Drupal\strata\Codec\CodecRegistry $registry

The registry to read availability from.

string $id

The codec id.

Returns

\Drupal\strata\Codec\CodecProfile —

The profile, marked unavailable when nothing on this host can run it.

labels()

labels() : array<string,string>

Human-readable names.

Returns

array

Codec id keyed to label.

summaries()

summaries() : array<string,string>

One sentence each on what a codec is for.

Returns

array

Codec id keyed to summary.

install()

install() : array<string,array<string,string>>

How to install each codec, by platform.

Returns

array> —

Codec id keyed to platform label keyed to command.

documentation()

documentation() : array<string,string>

Where to read more about each codec.

Returns

array

Codec id keyed to URL.

referenceMeasurements()

referenceMeasurements() : array<string,list<\Drupal\strata\Codec\CodecMeasurement>>

The shipped reference measurements described in this class's docblock.

Returns

array> —

Codec id keyed to its measurements.