Skip to content

✨ Add bsdtar vs pna performance benchmark script#2934

Draft
ChanTsune wants to merge 1 commit into
mainfrom
resources/add-bsdtar-bench
Draft

✨ Add bsdtar vs pna performance benchmark script#2934
ChanTsune wants to merge 1 commit into
mainfrom
resources/add-bsdtar-bench

Conversation

@ChanTsune
Copy link
Copy Markdown
Owner

Add hyperfine-based benchmark comparing bsdtar and pna create/extract performance across store, deflate, xz, and zstd compression. Generates Markdown and JSON reports with archive size comparison.

Add hyperfine-based benchmark comparing bsdtar and pna
create/extract performance across store, deflate, xz, and zstd
compression. Generates Markdown and JSON reports with archive
size comparison.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 8, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 237cdeeb-0e9e-4c40-9b31-cd56aa818465

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch resources/add-bsdtar-bench

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a performance benchmarking suite to compare bsdtar and pna processing speeds. It includes a comprehensive Bash script for automated data generation and benchmarking using hyperfine, as well as a detailed README. Feedback focuses on improving the script's portability and robustness, specifically addressing a non-portable dd flag on macOS, ensuring the realpath dependency is verified, and refining how CPU information is captured on Linux systems.

for i in $(seq 1 "$zero_count"); do
local subdir="$target_dir/zero/dir$(( (i - 1) / 50 ))"
mkdir -p "$subdir"
dd if=/dev/zero bs=1024 count="$zero_size_kb" of="$subdir/zero_${i}.bin" status=none
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The status=none flag for dd is a GNU extension and is not supported by the default dd on macOS (BSD-based). This will cause the test data generation to fail on macOS with an unknown status none error. Use 2>/dev/null to silence dd portably.

Suggested change
dd if=/dev/zero bs=1024 count="$zero_size_kb" of="$subdir/zero_${i}.bin" status=none
dd if=/dev/zero bs=1024 count="$zero_size_kb" of="$subdir/zero_${i}.bin" 2>/dev/null

Comment on lines +69 to +71
check_command hyperfine
check_command "$BSDTAR_BIN"
check_command "$PNA_BIN"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The script uses realpath on lines 118 and 236, but it is not checked in the check_command list. Since realpath is not always available by default on all systems (e.g., older macOS versions without GNU coreutils), it should be verified or a fallback should be provided.

Suggested change
check_command hyperfine
check_command "$BSDTAR_BIN"
check_command "$PNA_BIN"
check_command hyperfine
check_command "$BSDTAR_BIN"
check_command "$PNA_BIN"
if ! command -v realpath &>/dev/null; then
echo "Error: 'realpath' not found. Please install coreutils or provide a realpath implementation." >&2; exit 1
fi

mem_bytes=$(sysctl -n hw.memsize 2>/dev/null || echo 0)
echo "- **Memory**: $(human_size "$mem_bytes")"
else
echo "- **CPU**: $(lscpu 2>/dev/null | awk -F: '/Model name/{gsub(/^ +/,"",$2); print $2}' || echo 'unknown')"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

If lscpu is missing on a Linux system, the pipe to awk will result in an empty string, and the || echo 'unknown' fallback might not trigger because awk itself exits with status 0. It's safer to capture the output and check if it's empty.

Suggested change
echo "- **CPU**: $(lscpu 2>/dev/null | awk -F: '/Model name/{gsub(/^ +/,"",$2); print $2}' || echo 'unknown')"
local cpu_info
cpu_info=$(lscpu 2>/dev/null | awk -F: '/Model name/{gsub(/^ +/,"",$2); print $2}')
echo "- **CPU**: ${cpu_info:-unknown}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant