nextest_runner/record/dicts/mod.rs
1// Copyright (c) The nextest Contributors
2// SPDX-License-Identifier: MIT OR Apache-2.0
3
4//! Pre-trained zstd dictionaries for compressing test output.
5//!
6//! These dictionaries were trained on test output from a variety of Rust
7//! projects and provide ~40-60% compression improvement over standard zstd for
8//! typical test stdout/stderr.
9//!
10//! Dictionaries are stored in each archive (`meta/stdout.dict`, `meta/stderr.dict`)
11//! to make archives self-contained. This module provides the dictionaries used
12//! when creating new archives.
13
14/// Pre-trained zstd dictionary for test stdout.
15///
16/// Provides ~40-60% compression improvement for typical test output.
17pub static STDOUT: &[u8] = include_bytes!("stdout.dict");
18
19/// Pre-trained zstd dictionary for test stderr.
20///
21/// Provides ~35-60% compression improvement for typical test output.
22pub static STDERR: &[u8] = include_bytes!("stderr.dict");
23
24#[cfg(test)]
25mod tests {
26 use super::*;
27
28 #[test]
29 fn dictionaries_have_expected_sizes() {
30 // These sizes are based on training with --dict-size 8192. stdout.dict
31 // is exactly 8192 bytes, stderr.dict is smaller due to fewer samples.
32 assert_eq!(STDOUT.len(), 8192, "stdout dictionary size");
33 assert_eq!(STDERR.len(), 4809, "stderr dictionary size");
34 }
35}