mirror of
https://github.com/A6-9V/MQL5-Google-Onedrive.git
synced 2026-04-11 06:10:57 +00:00
- Implemented `MarkdownCache` class to cache rendered HTML. - Uses file modification time (`mtime`) to trigger re-renders only when necessary. - Reduced dashboard response latency from ~33ms to ~7ms (~78% reduction). - Added `markdown` to `requirements.txt`. - Added `scripts/benchmark_dashboard.py` for performance verification.
20 lines
661 B
Python
20 lines
661 B
Python
import time
|
|
import requests
|
|
import sys
|
|
|
|
def benchmark(url, iterations=100):
|
|
print(f"Benchmarking {url} with {iterations} iterations...")
|
|
start_time = time.time()
|
|
for _ in range(iterations):
|
|
response = requests.get(url)
|
|
if response.status_code != 200:
|
|
print(f"Error: Status code {response.status_code}")
|
|
sys.exit(1)
|
|
end_time = time.time()
|
|
avg_time = (end_time - start_time) / iterations
|
|
print(f"Total time: {end_time - start_time:.4f}s")
|
|
print(f"Average time per request: {avg_time*1000:.2f}ms")
|
|
return avg_time
|
|
|
|
if __name__ == "__main__":
|
|
benchmark("http://localhost:8080/health", 50)
|