Skip to content
Merged
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
2 changes: 2 additions & 0 deletions collector/compile-benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ compiler in interesting ways.
- **externs**: A large number of extern functions has caused [slowdowns in the past](https://github.com/rust-lang/rust/pull/78448).
- **helloworld-tiny**: A trivial program optimized with flags that should reduce binary size.
Gives a lower bound on compiled binary size.
- **include-blob**: Stress test for including binary and string blobs with `include_str!` and
`include_bytes!`. Its build script generates 30 MiB blobs that are then included into the program.
- **issue-46449**: A small program that caused [poor
performance](https://github.com/rust-lang/rust/issues/46449) in the past.
- **issue-58319**: A small program that caused [poor
Expand Down
5 changes: 5 additions & 0 deletions collector/compile-benchmarks/REUSE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ path = "image-0.25.6/**"
SPDX-FileCopyrightText = "The image-rs Developers"
SPDX-License-Identifier = "MIT"

[[annotations]]
path = "include-blob/**"
SPDX-FileCopyrightText = "The Rust Project Developers (see https://thanks.rust-lang.org)"
SPDX-License-Identifier = "MIT OR Apache-2.0"

[[annotations]]
path = "inflate/**"
SPDX-FileCopyrightText = "inflate contributors"
Expand Down
11 changes: 11 additions & 0 deletions collector/compile-benchmarks/include-blob/0-println.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
diff --git a/src/main.rs b/src/main.rs
index 9cb1671e..fc854410 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -6,5 +6,5 @@ fn main() {
"Binary blob last element: {}",
BLOB_BINARY[BLOB_BINARY.len() - 1]
);
- println!("String blob: {BLOB_STRING}");
+ println!("String blob contents: {BLOB_STRING}");
}
7 changes: 7 additions & 0 deletions collector/compile-benchmarks/include-blob/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions collector/compile-benchmarks/include-blob/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "include-blob"
version = "0.1.0"
edition = "2024"

[dependencies]

[workspace]
13 changes: 13 additions & 0 deletions collector/compile-benchmarks/include-blob/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use std::path::PathBuf;

fn main() {
let byte_count = 30usize * 1024 * 1024;
let out_dir = PathBuf::from(std::env::var("OUT_DIR").expect("OUT_DIR is missing"));

// Generate large (30 MiB) blobs of data to include into the resulting program
let binary_data: Vec<u8> = (0..byte_count).map(|v| (v % 256) as u8).collect();
std::fs::write(out_dir.join("blob-binary"), binary_data).expect("cannot write binary blob");

let string_data: String = ('a'..'z').cycle().take(byte_count).collect();
std::fs::write(out_dir.join("blob-string"), string_data).expect("cannot write string blob");
}
4 changes: 4 additions & 0 deletions collector/compile-benchmarks/include-blob/perf-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"category": "secondary",
"artifact": "binary"
}
7 changes: 7 additions & 0 deletions collector/compile-benchmarks/include-blob/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const BLOB_BINARY: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/blob-binary"));
const BLOB_STRING: &str = include_str!(concat!(env!("OUT_DIR"), "/blob-string"));

fn main() {
println!("Binary blob: {BLOB_BINARY:?}");
println!("String blob: {BLOB_STRING:?}");
}
Loading