-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8b0194b
commit e3392f9
Showing
3 changed files
with
12 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,15 @@ | ||
#!/bin/bash | ||
|
||
# Function to run a command and measure its time | ||
measure_time() { | ||
local cmd=$1 | ||
local output_file=$2 | ||
|
||
{ time $cmd; } 2> $output_file | ||
} | ||
|
||
# Function to extract time from the output file | ||
extract_time() { | ||
local output_file=$1 | ||
grep "real" $output_file | awk '{print $2}' | ||
} | ||
|
||
# Ensure the frm binary is built | ||
cargo build --release | ||
|
||
# Generate test data | ||
bash test_data_gen.sh | ||
|
||
# Measure time for rm -rf | ||
measure_time "rm -rf ./test_data" "rm_time.txt" | ||
rm_time=$(extract_time "rm_time.txt") | ||
|
||
# Regenerate test data | ||
bash test_data_gen.sh | ||
|
||
# Measure time for frm | ||
measure_time "./target/release/frm ./test_data" "frm_time.txt" | ||
frm_time=$(extract_time "frm_time.txt") | ||
|
||
# Create performance.md file | ||
cat <<EOL > performance.md | ||
# Performance Benchmark | ||
## Results | ||
| Command | Time (s) | | ||
|---------|----------| | ||
| rm -rf | $rm_time | | ||
| frm | $frm_time | | ||
## Conclusion | ||
The table above shows the time taken by each command to delete the test data directory. The \`frm\` command is compared against the traditional \`rm -rf\` command. | ||
EOL | ||
|
||
# Clean up | ||
rm rm_time.txt frm_time.txt | ||
|
||
# hyperfine --warmup 3 --export-markdown performance.md \ | ||
# --prepare 'bash test_data_gen.sh && sleep 2' \ | ||
# 'rm -rf ./test_data' \ | ||
# './target/release/frm ./test_data' | ||
|
||
clear | ||
echo "| Command | Time (s) |" | ||
echo "|---------|----------|" | ||
echo "| rm -rf | $rm_time |" | ||
echo "| frm | $frm_time |" | ||
echo "" | ||
echo "" | ||
echo "" | ||
hyperfine --export-markdown performance.md \ | ||
--prepare 'bash test_data_gen.sh && sleep 2' \ | ||
'rm -rf ./test_data' \ | ||
'./target/release/frm ./test_data' | ||
|
||
echo "Benchmarking complete. Results stored in performance.md." | ||
rm -rf ./test_data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +0,0 @@ | ||
# Performance Benchmark | ||
|
||
## Results | ||
|
||
| Command | Time (s) | | ||
| ------- | -------- | | ||
| rm -rf | 0m0.285s | | ||
| frm | 0m0.276s | | ||
|
||
## Conclusion | ||
|
||
The table above shows the time taken by each command to delete the test data directory. The `frm` command is compared against the traditional `rm -rf` command. | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters