-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbenchmark_test.sh
More file actions
executable file
·53 lines (43 loc) · 1.26 KB
/
Copy pathbenchmark_test.sh
File metadata and controls
executable file
·53 lines (43 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
# Performance benchmark test for brackets-code
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
BRACKETS_CODE="$SCRIPT_DIR/brackets-code"
LOG_FILE="$SCRIPT_DIR/benchmark.log"
echo "=========================================="
echo "Brackets-Code Performance Benchmark"
echo "=========================================="
echo ""
# Configuration
TARGET_BLOCKS=20
echo "Target: $TARGET_BLOCKS blocks"
echo ""
# Run code generation
echo "Running performance test..."
"$BRACKETS_CODE" "$TARGET_BLOCKS"
# Calculate metrics
echo ""
echo "=========================================="
echo "Results"
echo "=========================================="
# Extract time from output
GEN_TIME=$(echo "$@" | grep "^[0-9.]*")
if [ -z "$GEN_TIME" ]; then
echo "ERROR: Could not extract generation time"
exit 1
fi
echo "Generated: $TARGET_BLOCKS blocks"
echo "Time: ${GEN_TIME}s"
echo "Blocks/sec: $(echo "$GEN_TIME" | awk '{print int(1000/$GEN_TIME)}')"
echo "Target: ~${TARGET_BLOCKS*1000/20}ms/block"
# Check if we met the target
if [ $(echo "$GEN_TIME <= 15000" | bc -l) -eq 1 ]; then
echo ""
echo "✓ PERFORMANCE TARGET MET!"
echo "✓ Code generation is within acceptable range"
exit 0
else
echo ""
echo "✗ PERFORMANCE TARGET NOT MET"
exit 1
fi