#!/bin/bash # Collect performance data for different decimal counts DECIMALS="1 2 5 10 100 1000 2000" OUTPUT_FILE="performance_data.csv" echo "Decimals,Language,Time(ms),Memory(MB),Status" > $OUTPUT_FILE for dec in $DECIMALS; do echo "Testing with $dec decimals..." ./run_all.sh $dec 2>&1 | grep -E "SUCCESS|FAILED" | while read line; do # Extract language name and data lang=$(echo "$line" | awk '{print $1}') time=$(echo "$line" | grep -oE '[0-9]+ ms' | awk '{print $1}') mem=$(echo "$line" | grep -oE '[0-9]+MB avg' | awk '{print $1}') status=$(echo "$line" | grep -oE 'SUCCESS|FAILED') if [ -n "$lang" ] && [ -n "$time" ]; then echo "$dec,$lang,$time,$mem,$status" >> $OUTPUT_FILE fi done done echo "Data collected in $OUTPUT_FILE"