Skip to content

Performance Issue? #79

@JanSlabon

Description

@JanSlabon

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:
Image

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

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

Is this the normal behavior?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions