Add compression vs no-compression benchmark tests
- Modify run_fastsync() to accept compression flag parameter - Add separate test runs for fastSyncAI with and without LZ4 compression - Display both compressed (LZ4) and uncompressed results in output - Update analysis to show compression speedup benefit - Use compressed results as primary comparison against rsync Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
+55
-15
@@ -220,8 +220,9 @@ verify() {
|
||||
# ── Run fastSyncAI ────────────────────────────────────────────────────────
|
||||
run_fastsync() {
|
||||
local nconn=$1
|
||||
local dst="$DST_DIR_BASE/fastsync_${nconn}"
|
||||
local port=$((FASTSYNC_PORT + nconn))
|
||||
local use_compress=$2
|
||||
local dst="$DST_DIR_BASE/fastsync_${nconn}_${use_compress}"
|
||||
local port=$((FASTSYNC_PORT + nconn + (use_compress * 100)))
|
||||
rm -rf "$dst"
|
||||
mkdir -p "$dst"
|
||||
|
||||
@@ -230,7 +231,9 @@ run_fastsync() {
|
||||
sleep 1
|
||||
|
||||
local output
|
||||
output=$(timeout 600 "$CLIENT_BIN" -h "$HOST" -p "$port" -s "$SRC_DIR" -n "$nconn" 2>&1) || true
|
||||
local compress_flag=""
|
||||
[ "$use_compress" -eq 0 ] && compress_flag="-c"
|
||||
output=$(timeout 600 "$CLIENT_BIN" -h "$HOST" -p "$port" -s "$SRC_DIR" -n "$nconn" $compress_flag 2>&1) || true
|
||||
|
||||
# Extract actual transfer time from client output
|
||||
local transfer_ms=$(echo "$output" | grep -oP 'ms=\K[0-9.]+' || echo "0")
|
||||
@@ -331,13 +334,23 @@ info "Testing over network (${SCENARIO_NAME})..."
|
||||
echo ""
|
||||
|
||||
# Collect results
|
||||
declare -a FS_RES RSYNC_RES RSYNCC_RES
|
||||
declare -a FS_RES FS_COMP_RES RSYNC_RES RSYNCC_RES
|
||||
|
||||
# fastSyncAI tests
|
||||
# fastSyncAI tests (with compression - default)
|
||||
for i in "${!CONN_COUNTS[@]}"; do
|
||||
n=${CONN_COUNTS[$i]}
|
||||
echo -n " ${FS_LABELS[$i]}... "
|
||||
result=$(run_fastsync $n)
|
||||
echo -n " ${FS_LABELS[$i]} (compressed)... "
|
||||
result=$(run_fastsync $n 1)
|
||||
IFS='|' read -r ms mbs ok <<< "$result"
|
||||
FS_COMP_RES+=("$ms|$mbs|$ok")
|
||||
[ "$ok" -eq 1 ] && ok "${mbs} MB/s (${ms}ms)" || warn "${mbs} MB/s (${ms}ms) FAILED"
|
||||
done
|
||||
|
||||
# fastSyncAI tests (without compression)
|
||||
for i in "${!CONN_COUNTS[@]}"; do
|
||||
n=${CONN_COUNTS[$i]}
|
||||
echo -n " ${FS_LABELS[$i]} (uncompressed)... "
|
||||
result=$(run_fastsync $n 0)
|
||||
IFS='|' read -r ms mbs ok <<< "$result"
|
||||
FS_RES+=("$ms|$mbs|$ok")
|
||||
[ "$ok" -eq 1 ] && ok "${mbs} MB/s (${ms}ms)" || warn "${mbs} MB/s (${ms}ms) FAILED"
|
||||
@@ -369,7 +382,7 @@ echo ""
|
||||
# Calculate max for scaling
|
||||
calc_max() {
|
||||
local max=0
|
||||
for res in "${FS_RES[@]}" "${RSYNC_RES[@]}" "${RSYNCC_RES[@]}"; do
|
||||
for res in "${FS_RES[@]}" "${FS_COMP_RES[@]}" "${RSYNC_RES[@]}" "${RSYNCC_RES[@]}"; do
|
||||
local mbs=$(echo "$res" | cut -d'|' -f2)
|
||||
local int=$(echo "$mbs" | awk '{printf "%d", $1+0}')
|
||||
[ "$int" -gt "$max" ] 2>/dev/null && max=$int
|
||||
@@ -382,6 +395,13 @@ MAX_MBS=$(calc_max)
|
||||
printf " %-22s %-10s %-10s %s\n" "Tool" "Time (ms)" "MB/s" "Throughput"
|
||||
printf " %-22s %-10s %-10s %s\n" "----------------------" "----------" "----------" "------------"
|
||||
|
||||
for i in "${!FS_COMP_RES[@]}"; do
|
||||
IFS='|' read -r ms mbs ok <<< "${FS_COMP_RES[$i]}"
|
||||
bar=$(draw_bar "$mbs" "$MAX_MBS")
|
||||
v=$([ "$ok" -eq 1 ] && echo "✓" || echo "✗")
|
||||
printf " %-22s %-10s %-10s %s %s\n" "${FS_LABELS[$i]} (LZ4)" "$ms" "$mbs" "$bar" "$v"
|
||||
done
|
||||
|
||||
for i in "${!FS_RES[@]}"; do
|
||||
IFS='|' read -r ms mbs ok <<< "${FS_RES[$i]}"
|
||||
bar=$(draw_bar "$mbs" "$MAX_MBS")
|
||||
@@ -408,31 +428,51 @@ echo -e "${BOLD} ANALYSIS${RESET}"
|
||||
echo -e "${BOLD}═══════════════════════════════════════════════════════════════════════════╝${RESET}"
|
||||
echo ""
|
||||
|
||||
# Find best
|
||||
# Find best (use compressed results as primary)
|
||||
best_idx=0
|
||||
best_mbs=0
|
||||
for i in "${!FS_RES[@]}"; do
|
||||
this_mbs=$(echo "${FS_RES[$i]}" | cut -d'|' -f2 | awk '{printf "%d", $1+0}')
|
||||
for i in "${!FS_COMP_RES[@]}"; do
|
||||
this_mbs=$(echo "${FS_COMP_RES[$i]}" | cut -d'|' -f2 | awk '{printf "%d", $1+0}')
|
||||
[ "$this_mbs" -gt "$best_mbs" ] && best_mbs=$this_mbs && best_idx=$i
|
||||
done
|
||||
best_label="${FS_LABELS[$best_idx]}"
|
||||
best_label="${FS_LABELS[$best_idx]} (LZ4)"
|
||||
|
||||
# Also find best uncompressed for comparison
|
||||
best_no_compress_idx=0
|
||||
best_no_compress_mbs=0
|
||||
for i in "${!FS_RES[@]}"; do
|
||||
this_mbs=$(echo "${FS_RES[$i]}" | cut -d'|' -f2 | awk '{printf "%d", $1+0}')
|
||||
[ "$this_mbs" -gt "$best_no_compress_mbs" ] && best_no_compress_mbs=$this_mbs && best_no_compress_idx=$i
|
||||
done
|
||||
best_no_compress_label="${FS_LABELS[$best_no_compress_idx]}"
|
||||
|
||||
|
||||
|
||||
IFS='|' read -r rs_ms rs_mbs rs_ok <<< "${RSYNC_RES[0]}"
|
||||
rs_mbs_int=$(echo "$rs_mbs" | awk '{printf "%d", $1+0}')
|
||||
|
||||
ok "Best fastSyncAI: $best_label (${best_mbs} MB/s)"
|
||||
ok "Best fastSyncAI (LZ4): $best_label (${best_mbs} MB/s)"
|
||||
ok "Best fastSyncAI (no compress): $best_no_compress_label (${best_no_compress_mbs} MB/s)"
|
||||
|
||||
# Compression benefit
|
||||
if [ "$best_mbs" -gt 0 ] && [ "$best_no_compress_mbs" -gt 0 ]; then
|
||||
if [ "$best_mbs" -gt "$best_no_compress_mbs" ]; then
|
||||
compress_speedup=$(awk "BEGIN {printf \"%.2f\", $best_mbs / ($best_no_compress_mbs == 0 ? 0.01 : $best_no_compress_mbs)}")
|
||||
echo -e " ${GREEN}Compression provides ${compress_speedup}x speedup${RESET}"
|
||||
else
|
||||
echo -e " ${YELLOW}Compression: no benefit (data likely incompressible)${RESET}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$rs_mbs_int" -gt 0 ]; then
|
||||
echo ""
|
||||
echo "Speedup vs rsync (both over ${SCENARIO_NAME}):"
|
||||
speedup=$(awk "BEGIN {printf \"%.2f\", $best_mbs / ($rs_mbs_int == 0 ? 0.01 : $rs_mbs_int)}")
|
||||
if [ "$best_mbs" -gt "$rs_mbs_int" ]; then
|
||||
echo -e " ${GREEN}fastSyncAI is ${speedup}x FASTER than rsync${RESET}"
|
||||
echo -e " ${GREEN}fastSyncAI (LZ4) is ${speedup}x FASTER than rsync${RESET}"
|
||||
elif [ "$rs_mbs_int" -gt "$best_mbs" ]; then
|
||||
speedup=$(awk "BEGIN {printf \"%.2f\", $rs_mbs_int / ($best_mbs == 0 ? 0.01 : $best_mbs)}")
|
||||
echo -e " ${GREEN}rsync is ${speedup}x faster than fastSyncAI${RESET}"
|
||||
echo -e " ${GREEN}rsync is ${speedup}x faster than fastSyncAI (LZ4)${RESET}"
|
||||
else
|
||||
echo -e " Both performed similarly"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user