added: profiling toolchain (py-spy, pyinstrument, pytest-benchmark, memray, snakeviz)
New `profile` optional-deps group, opt-in Pyinstrument ASGI middleware gated by DECNET_PROFILE_REQUESTS, bench marker + tests/perf/ micro-benchmarks for repository hot paths, and scripts/profile/ helpers for py-spy/cProfile/memray.
This commit is contained in:
15
scripts/profile/memray-api.sh
Executable file
15
scripts/profile/memray-api.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
# Run the DECNET API under memray to capture an allocation profile.
|
||||
# Stop with Ctrl-C; then render with `memray flamegraph <bin>`.
|
||||
set -euo pipefail
|
||||
|
||||
HOST="${DECNET_API_HOST:-127.0.0.1}"
|
||||
PORT="${DECNET_API_PORT:-8000}"
|
||||
OUT="${OUT:-profiles/memray-$(date +%s).bin}"
|
||||
mkdir -p "$(dirname "$OUT")"
|
||||
|
||||
echo "Starting uvicorn under memray -> ${OUT}"
|
||||
python -m memray run -o "${OUT}" -m uvicorn decnet.web.api:app \
|
||||
--host "${HOST}" --port "${PORT}" --log-level warning
|
||||
|
||||
echo "Render with: memray flamegraph ${OUT}"
|
||||
Reference in New Issue
Block a user