Skip to content

Commit

Permalink
Fix sed for better portability
Browse files Browse the repository at this point in the history
  • Loading branch information
andrews05 committed Sep 28, 2023
1 parent 3861987 commit a0faa20
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scripts/compare.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash
cargo build --release
sed -i '' '/## Benchmarks/,$d' README.md
sed -i.bak '/## Benchmarks/,$d' README.md
rm README.md.bak

CORES=$(sysctl -n hw.ncpu 2>/dev/null || grep -c ^processor /proc/cpuinfo)
CPU=$(sysctl -n machdep.cpu.brand_string 2>/dev/null || grep '^model name' /proc/cpuinfo | sed 's/model name.\+: //g' | head -n 1)
Expand All @@ -9,7 +10,7 @@ OPTIPNG_VERSION=$(optipng -v | head -n 1)
RUST_VERSION=$(rustc -V)
echo -e '## Benchmarks\n' >> README.md
echo "Tested $OXIPNG_VERSION (compiled on $RUST_VERSION) against $OPTIPNG_VERSION on $CPU with $CORES logical cores" >> README.md
echo -e '\n\n```\n' >> README.md
echo -e '\n```\n' >> README.md

hyperfine --style basic --warmup 5 './target/release/oxipng -P ./tests/files/rgb_16_should_be_grayscale_8.png' 'optipng -simulate ./tests/files/rgb_16_should_be_grayscale_8.png' >> README.md
echo -e '\n\n' >> README.md
Expand Down

0 comments on commit a0faa20

Please sign in to comment.