Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ All notable changes to the Rust Apify API client are documented here. The format
based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project adheres
to [Semantic Versioning](https://semver.org/).

## [Unreleased]

### Changed
- Brotli request bodies are compressed at quality 1 instead of the reference client's 6. On
dataset items that makes compression about 5x faster (about 1.3 ms to 0.27 ms per 70 KB item)
for bodies about 14% larger.

## [0.13.0] - 2026-10-19

### Added
Expand Down
8 changes: 5 additions & 3 deletions src/http_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ const MIN_COMPRESS_BYTES: usize = 1024;
const CONTENT_ENCODING_BROTLI: &str = "br";
/// `Content-Encoding` value used for gzip-compressed request bodies.
const CONTENT_ENCODING_GZIP: &str = "gzip";
/// Brotli quality level (0–11). The reference client compresses request bodies at quality 6,
/// which balances ratio against CPU cost; we mirror that.
const BROTLI_QUALITY: u32 = 6;
/// Brotli quality level (0–11). The reference client uses quality 6, but on dataset items quality
/// 1 is about 5x faster for bodies about 14% larger (the body still shrinks by over 80%). Qualities
/// 2 to 5 are barely faster than 6. For scrapers pushing many items, compression is a noticeable
/// share of their CPU time.
const BROTLI_QUALITY: u32 = 1;
/// Brotli sliding-window size (log2), 22 is the library default (a 4 MiB window).
const BROTLI_WINDOW_SIZE: u32 = 22;
/// Internal buffer size for the brotli encoder.
Expand Down
Loading