-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
88 lines (76 loc) · 2.82 KB
/
Copy pathMakefile
File metadata and controls
88 lines (76 loc) · 2.82 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
.PHONY: test benchmark benchmark-save benchmark-compare benchmark-report cross-benchmark profile profile-complex profile-all
test:
go test ./
benchmark:
go test ./ -bench=. -benchmem
# Run benchmarks and save as latest
benchmark-save:
mkdir -p benchstat
go test ./ -bench=. -benchmem -count=1 | tee benchstat/latest.txt
@echo "Benchmark results saved to benchstat/latest.txt"
# Compare with previous benchmark
benchmark-compare:
@if [ ! -f benchstat/previous.txt ]; then \
echo "No previous benchmark found. Run 'make benchmark-save-as-previous' first."; \
exit 1; \
fi
@if [ ! -f benchstat/latest.txt ]; then \
echo "No latest benchmark found. Run 'make benchmark-save' first."; \
exit 1; \
fi
benchstat benchstat/previous.txt benchstat/latest.txt
# Save latest as previous for future comparisons
benchmark-save-as-previous:
@if [ ! -f benchstat/latest.txt ]; then \
echo "No latest benchmark found. Run 'make benchmark-save' first."; \
exit 1; \
fi
cp benchstat/latest.txt benchstat/previous.txt
@echo "Latest benchmark saved as previous for future comparisons"
# Compare with another branch
benchmark-branch:
@if [ -z "$(branch)" ]; then \
echo "Usage: make benchmark-branch branch=<branch_name>"; \
exit 1; \
fi
./scripts/compare_benchmarks.sh $(branch)
# Generate a benchmark report
benchmark-report:
@if [ ! -f benchstat/previous.txt ]; then \
echo "No previous benchmark file found"; \
exit 1; \
fi
@mkdir -p benchstat/reports
@REPORT_FILE="benchstat/reports/report-$$(date +%Y%m%d-%H%M%S).md"; \
echo "# Benchmark Report - $$(date '+%Y-%m-%d %H:%M:%S')" > $$REPORT_FILE; \
echo "" >> $$REPORT_FILE; \
echo "\`\`\`" >> $$REPORT_FILE; \
benchstat benchstat/previous.txt benchstat/latest.txt >> $$REPORT_FILE; \
echo "\`\`\`" >> $$REPORT_FILE; \
echo "" >> $$REPORT_FILE; \
echo "Report saved to $$REPORT_FILE"
# Run cross-language benchmarks to compare Go and Python implementations
cross-benchmark:
@echo "Running cross-language benchmarks..."
@cmd/benchmark/run_benchmarks.sh --output-dir benchstat/cross
@echo "Cross-language benchmark report saved to benchstat/cross/comparison_report.txt"
# Run profiling for a complex template
profile-complex:
@echo "Running profiling for complex_template..."
@chmod +x cmd/profile/profile.sh
@cmd/profile/profile.sh --template complex_template --all
# Run profiling for nested_loops template
profile-nested-loops:
@echo "Running profiling for nested_loops..."
@chmod +x cmd/profile/profile.sh
@cmd/profile/profile.sh --template nested_loops --all
# Run profiling for all templates
profile-all:
@echo "Running profiling for all templates..."
@chmod +x cmd/profile/profile.sh
@cmd/profile/profile.sh --all-templates --all
# Run profiling with custom options
profile:
@echo "Running custom profiling..."
@chmod +x cmd/profile/profile.sh
@cmd/profile/profile.sh $(ARGS)