Files
PromptTech/scripts/test_reload_performance.sh

37 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
echo "=== Testing Reload Performance ==="
echo ""
echo "1. Backend API Response:"
curl -s -o /dev/null -w " - Status: %{http_code}\n - Time: %{time_total}s\n - Size: %{size_download} bytes\n" http://localhost:8181/api/products
echo ""
echo "2. Frontend Initial Load:"
curl -s -o /dev/null -w " - Status: %{http_code}\n - Time: %{time_total}s\n - Size: %{size_download} bytes\n" http://localhost:5300
echo ""
echo "3. Database Connection:"
cd backend && source venv/bin/activate && python -c "
from sqlalchemy import create_engine, text
import os, time
start = time.time()
engine = create_engine(os.getenv('DATABASE_URL', 'postgresql://admin:admin@localhost/tech_store'))
with engine.connect() as conn:
result = conn.execute(text('SELECT COUNT(*) FROM products'))
count = result.scalar()
elapsed = time.time() - start
print(f' - Products: {count}')
print(f' - Query Time: {elapsed:.4f}s')
"
echo ""
echo "4. Cache Test (2nd request should be cached):"
echo " First request:"
curl -s -o /dev/null -w " Time: %{time_total}s\n" http://localhost:8181/api/products
echo " Second request (should be faster with cache):"
curl -s -o /dev/null -w " Time: %{time_total}s\n" http://localhost:8181/api/products
echo ""
echo "✅ Performance test complete!"