Initial commit - PromptTech
This commit is contained in:
36
scripts/test_reload_performance.sh
Executable file
36
scripts/test_reload_performance.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/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!"
|
||||
Reference in New Issue
Block a user