We're evaluating Brotli compression for PDF files, which will land in the near future in the PDF specification (see here for more details).
While doing some tests on our test environments, we noticed that Brotli is (sometimes extremely) slow compared to e.g. gzcompress().
We used following test script:
$string = \str_repeat('AAAAAAABBBBBBCCCCCC', 10000);
$iterations = 100;
$start = \microtime(true);
for ($i = 0; $i < $iterations; $i++) {
\gzcompress($string);
}
$end = \microtime(true);
echo "Flate: " . ($end - $start) . "\n";
$start = \microtime(true);
for ($i = 0; $i < $iterations; $i++) {
\brotli_compress($string);
}
$end = \microtime(true);
echo "Brotli: " . ($end - $start) . "\n";
On Windwos this script outputs:

On a simple Docker setup (Linux) it's not that extrem but also a noticable difference:

We also tried a similar script with "official" test-data (enwik8.zip), which results in:

Is this the normal behavior?
We're evaluating Brotli compression for PDF files, which will land in the near future in the PDF specification (see here for more details).
While doing some tests on our test environments, we noticed that Brotli is (sometimes extremely) slow compared to e.g.
gzcompress().We used following test script:
On Windwos this script outputs:

On a simple Docker setup (Linux) it's not that extrem but also a noticable difference:

We also tried a similar script with "official" test-data (enwik8.zip), which results in:

Is this the normal behavior?