mirror of
https://github.com/google/brotli.git
synced 2026-07-08 17:56:58 +00:00
[PR #1280] Improve throughput performance at compression level 9 #1858
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/google/brotli/pull/1280
Author: @uttampawar
Created: 6/12/2025
Status: 🔄 Open
Base:
master← Head:level9-opt📝 Commits (1)
cf1a2b9Improve throughput performance at compression level 9 by adjusting M_MMAP_THRESHOLD value.📊 Changes
1 file changed (+7 additions, -0 deletions)
View changed files
📝
c/enc/encode.c(+7 -0)📄 Description
This patch specifically addresses issue observed at level 9, it doesn't have adverse impact at other levels.
Following are the performance numbers in terms of throughput (bytes processed per sec) for various inputs on latest Xeon server.
Runtime 10 seconds
Compression level 9
Background
Children Self Shared Object Command
The detail stack trace shows following,
Children Self Command Shared Object Symbol
This gave clear indication of major cycles spent due to "page-faults". Collecting "perf stat" showed below stats,
$ perf stat -- ./bench -q 9 -c 1 index.html
Tested file index.html; size: 29329
Threads: 1, alg: brotli, quality 9
Total times compressed: 1716; compressed size: 7476
Compression speed:4.80 MiB
Performance counter stats for './bench -q 9 -c 1 index.html':
With suggested change page faults dropped considerably improving the performance.
Tested file index.html; size: 29329
Threads: 1, alg: brotli, quality 9
Total times compressed: 16109; compressed size: 7476
Compression speed:45.06 MiB
Performance counter stats for './bench -q 9 -c 1 index.html':
And majority cycles are spent in the application instead of kernel managing memory (mmap/munmap).
Children Self Shared Object
Environment:
OS: Ubuntu 24.04.2 LTS
Kernel: 6.8.0-58-generic
GCC: gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
Glibc: ldd (Ubuntu GLIBC 2.39-0ubuntu8.4) 2.39
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.