feat: memory profiling script#587
Conversation
Benchmark report
|
There was a problem hiding this comment.
Pull request overview
Adds a repo-root profile.sh helper script to measure peak heap memory usage during the transactions::run_base_system e2e test run and produce a speedscope-compatible flamegraph input.
Changes:
- Introduces
profile.shto build thetransactionstest binary in release mode and record allocations withheaptrack. - Extracts peak-memory flamegraph stacks via
heaptrack_printand demangles symbols withrustfilt. - Adds basic CLI usage/help output and dependency checks.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| echo "==> Recording heap profile -> ${OUTPUT_FILE}.zst (test logs: ${TEST_LOG})..." | ||
| heaptrack --record-only -o "$OUTPUT_FILE" \ | ||
| "$TEST_BIN" --exact run_base_system --nocapture \ | ||
| 2>&1 > "$TEST_LOG" |
There was a problem hiding this comment.
The stdout/stderr redirection order is wrong here: 2>&1 > "$TEST_LOG" sends stderr to the terminal and only stdout to the log. If the intent is to capture all test output in the log file, redirect stdout first and then stderr (or use a single combined redirection).
| 2>&1 > "$TEST_LOG" | |
| > "$TEST_LOG" 2>&1 |
| fi | ||
|
|
||
| if [[ -z "${1:-}" ]]; then | ||
| echo "Error: test name argument is required." >&2 |
There was a problem hiding this comment.
Error message says “test name argument”, but the required positional argument is a label used for output file names. Align the wording with the usage text to avoid confusion.
| echo "Error: test name argument is required." >&2 | |
| echo "Error: label argument is required." >&2 |
| @@ -0,0 +1,138 @@ | |||
| #!/bin/bash | |||
|
|
|||
| # set -euo pipefail | |||
There was a problem hiding this comment.
Because the script doesn’t enable set -e/pipefail (and also doesn’t manually check exit codes), failures in cargo test, heaptrack, heaptrack_print, or rustfilt can be silently ignored and still produce a “Done” message. Consider enabling strict mode (or explicitly checking command exit codes) so profiling failures fail fast.
| # set -euo pipefail | |
| set -euo pipefail |
There was a problem hiding this comment.
this is intentionally left out to be able to produce results even when the test OOMs
What ❔
A script to profile e2e test peak memory usage
Why ❔
Airbender v2 uses considerably more memory
Is this a breaking change?
Checklist