Skip to content

[3.14] compression.zstd is slow #761

@Rogdham

Description

@Rogdham

Hello, I'm noticing that the compression.zstd in CPython 3.14.0rc2 module has slow performance when using the release assets from this repository.

Local tests show between 4 and 7 times slowdown when compared to building CPython from source, depending on the Zstandard level, and operation made (compression/decompression).

Maybe related: #327

Reproducer

First, download enwik8.zip (official source), uncompress it at /tmp/enwik8 (should be 100Mo).

Then, run:

python -m timeit -s 'from compression import zstd; DATA = open("/tmp/enwik8","rb").read()' 'zstd.compress(DATA)'
Version Timing
Local build 1 loop, best of 5: 663 msec per loop
cpython-3.14.0rc2+20250814-x86_64-unknown-linux-gnu-install_only_stripped 1 loop, best of 5: 3.21 sec per loop
cpython-3.14.0rc2+20250814-x86_64_v2-unknown-linux-gnu-install_only_stripped 1 loop, best of 5: 3.2 sec per loop
cpython-3.14.0rc2+20250814-x86_64_v3-unknown-linux-gnu-install_only_stripped 1 loop, best of 5: 3.25 sec per loop
cpython-3.14.0rc2+20250814-x86_64-unknown-linux-gnu-pgo+lto-full 1 loop, best of 5: 3.23 sec per loop
cpython-3.14.0rc2+20250814-x86_64-unknown-linux-gnu-freethreaded+pgo+lto-full 1 loop, best of 5: 3.27 sec per loop

Tests performed under Archlinux.

Metadata

Metadata

Assignees

No one assigned

    Labels

    performancePotential performance improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions