Skip to content

Commit a7d36aa

Browse files
committed
feat: performance tests
1 parent 1cfa63a commit a7d36aa

File tree

7 files changed

+1476
-7
lines changed

7 files changed

+1476
-7
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,7 @@ __pycache__
1414

1515
*.swp
1616
*.pyc
17-
*.ipynb
17+
*.ipynb
18+
19+
# Performance test results (timestamped, machine-specific)
20+
perf_test/results/

Makefile

Lines changed: 78 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
LINT_TARGET_DIRS := PyEMD doc example
2+
PYTHON := .venv/bin/python
23

34
init:
45
python -m venv .venv
@@ -7,7 +8,7 @@ init:
78
@echo "Run 'source .venv/bin/activate' to activate the virtual environment"
89

910
test:
10-
python -m PyEMD.tests.test_all
11+
$(PYTHON) -m PyEMD.tests.test_all
1112

1213
clean:
1314
find PyEMD -name __pycache__ -execdir rm -r {} +
@@ -17,12 +18,84 @@ doc:
1718
cd doc && make html
1819

1920
format:
20-
python -m black $(LINT_TARGET_DIRS)
21-
python -m isort PyEMD
21+
$(PYTHON) -m black $(LINT_TARGET_DIRS)
22+
$(PYTHON) -m isort PyEMD
2223

2324
lint-check:
24-
python -m isort --check PyEMD
25-
python -m black --check $(LINT_TARGET_DIRS)
25+
$(PYTHON) -m isort --check PyEMD
26+
$(PYTHON) -m black --check $(LINT_TARGET_DIRS)
27+
28+
# Performance tests
29+
# Results saved to perf_test/results/<timestamp>/
30+
31+
.PHONY: perf perf-quick perf-scaling perf-splines perf-extrema perf-eemd perf-ceemdan perf-complexity perf-sifting
32+
33+
perf:
34+
@echo "Running full performance test suite..."
35+
$(PYTHON) perf_test/perf_test_comprehensive.py
36+
37+
perf-quick:
38+
@echo "Running quick performance test suite..."
39+
$(PYTHON) perf_test/perf_test_comprehensive.py --quick
40+
41+
perf-scaling:
42+
@echo "Running EMD scaling test..."
43+
$(PYTHON) perf_test/perf_test_comprehensive.py --test scaling
44+
45+
perf-splines:
46+
@echo "Running spline comparison test..."
47+
$(PYTHON) perf_test/perf_test_comprehensive.py --test splines
48+
49+
perf-extrema:
50+
@echo "Running extrema detection test..."
51+
$(PYTHON) perf_test/perf_test_comprehensive.py --test extrema
52+
53+
perf-eemd:
54+
@echo "Running EEMD parallel scaling test..."
55+
$(PYTHON) perf_test/perf_test_comprehensive.py --test eemd
56+
57+
perf-ceemdan:
58+
@echo "Running CEEMDAN performance test..."
59+
$(PYTHON) perf_test/perf_test_comprehensive.py --test ceemdan
60+
61+
perf-complexity:
62+
@echo "Running signal complexity test..."
63+
$(PYTHON) perf_test/perf_test_comprehensive.py --test complexity
64+
65+
perf-sifting:
66+
@echo "Running sifting parameters test..."
67+
$(PYTHON) perf_test/perf_test_comprehensive.py --test sifting
68+
69+
perf-compare:
70+
@if [ $$(ls -d perf_test/results/*/ 2>/dev/null | wc -l) -lt 2 ]; then \
71+
echo "Error: Need at least 2 result directories to compare"; \
72+
exit 1; \
73+
fi
74+
@BASELINE=$$(ls -dt perf_test/results/*/ | sed -n '2p' | sed 's/\/$$//'); \
75+
COMPARISON=$$(ls -dt perf_test/results/*/ | sed -n '1p' | sed 's/\/$$//'); \
76+
echo "Comparing:"; \
77+
echo " Baseline: $$BASELINE"; \
78+
echo " Comparison: $$COMPARISON"; \
79+
echo ""; \
80+
$(PYTHON) perf_test/compare_results.py "$$BASELINE" "$$COMPARISON"
81+
82+
perf-list:
83+
@echo "Available performance test targets:"
84+
@echo " make perf - Full test suite"
85+
@echo " make perf-quick - Quick test suite (smaller parameters)"
86+
@echo " make perf-scaling - EMD scaling with signal length"
87+
@echo " make perf-splines - Spline method comparison"
88+
@echo " make perf-extrema - Extrema detection comparison"
89+
@echo " make perf-eemd - EEMD parallel scaling"
90+
@echo " make perf-ceemdan - CEEMDAN performance"
91+
@echo " make perf-complexity - Signal complexity impact"
92+
@echo " make perf-sifting - Sifting parameters impact"
93+
@echo ""
94+
@echo "Comparison:"
95+
@echo " make perf-compare - Compare two most recent results"
96+
@echo " $(PYTHON) perf_test/compare_results.py <baseline> <comparison>"
97+
@echo ""
98+
@echo "Results saved to: perf_test/results/<timestamp>_<test>/"
2699

27100
perf/build:
28101
docker build -t pyemd-perf -f perf_test/Dockerfile .

PyEMD/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import logging
22

3-
__version__ = "1.6.4"
3+
__version__ = "1.7.0"
44
logger = logging.getLogger("pyemd")
55

66
from PyEMD.CEEMDAN import CEEMDAN # noqa

perf_test/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM python:3.10.13
2+
3+
COPY requirements.txt /tmp/requirements.txt
4+
RUN pip install -r /tmp/requirements.txt
5+
6+
COPY . /app
7+
WORKDIR /app
8+
9+
RUN pip install -e .
10+
11+
CMD ["python", "perf_test/main.py"]

0 commit comments

Comments
 (0)