feat: Phase 0 baseline benchmark script and log (WP-00) (#87) #95

Merged
Claude merged 3 commits from ai/paper-dynasty-database#87 into next-release 2026-03-23 04:00:03 +00:00
3 changed files with 8 additions and 9 deletions
Showing only changes of commit 2ab6e71735 - Show all commits

3
.gitignore vendored
View File

@ -83,3 +83,6 @@ postgres_data/
README_GAUNTLET_CLEANUP.md
wipe_gauntlet_team.py
SCHEMA.md
# Benchmark output files
benchmarks/render_timings.txt

View File

@ -70,8 +70,8 @@ echo "Elapsed: $(( (END - START) / 1000 )).$(( (END - START) % 1000 ))s"
| Environment | Cards | Elapsed (s) | Per-card avg (s) |
|-------------|-------|-------------|-----------------|
| dev | 20 | _TBD_ | _TBD_ |
| dev | 20 | _TBD_ | _TBD_ |
| dev (batting) | 20 | _TBD_ | _TBD_ |
| dev (pitching) | 20 | _TBD_ | _TBD_ |
> **Note:** Run the upload command in the `card-creation` repo and record timings here.

View File

@ -48,13 +48,9 @@ TOTAL=0
COUNT=0
Review

?nocache=1 is almost certainly not in the nginx proxy_cache_key and will be silently ignored, meaning this measures cache-hit latency (~ms) not full Playwright render time (~2-3s). Use the established cache-busting format instead:

URL="$API_BASE/api/v2/players/$player_id/${CARD_TYPE}card?d=$(date +%Y-%-m-%-d)-$(date +%s)"

This matches the ?d={year}-{month}-{day}-{timestamp} convention from the card-creation codebase and guarantees a cache miss per request.

`?nocache=1` is almost certainly not in the nginx `proxy_cache_key` and will be silently ignored, meaning this measures cache-hit latency (~ms) not full Playwright render time (~2-3s). Use the established cache-busting format instead: ```bash URL="$API_BASE/api/v2/players/$player_id/${CARD_TYPE}card?d=$(date +%Y-%-m-%-d)-$(date +%s)" ``` This matches the `?d={year}-{month}-{day}-{timestamp}` convention from the card-creation codebase and guarantees a cache miss per request.
for player_id in "${PLAYER_IDS[@]}"; do
URL="$API_BASE/api/v2/players/$player_id/${CARD_TYPE}card"
# Bypass cached PNG files by adding ?nocache=1 (treated as unknown param, triggers re-render)
# Remove this flag after baseline is captured to test cache-hit performance separately.
HTTP_CODE=$(curl -s -o /dev/null \
--write-out "%{http_code}" \
-w " %{time_total}" \
"$URL" 2>&1)
# Bypass cached PNG files; remove ?nocache=1 after baseline is captured to test cache-hit performance.
URL="$API_BASE/api/v2/players/$player_id/${CARD_TYPE}card?nocache=1"
Review

The 2>&1 redirect here causes curl error messages to be captured in $HTTP_CODE rather than appearing on stderr. Since curl -s already suppresses progress output, the only thing 2>&1 captures is actual error text (e.g. connection refused). With set -e active, a curl failure will abort the script — but silently, because the error was swallowed. Remove 2>&1 so errors surface to the terminal.

The `2>&1` redirect here causes curl error messages to be captured in `$HTTP_CODE` rather than appearing on stderr. Since `curl -s` already suppresses progress output, the only thing `2>&1` captures is actual error text (e.g. connection refused). With `set -e` active, a curl failure will abort the script — but silently, because the error was swallowed. Remove `2>&1` so errors surface to the terminal.
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code} %{time_total}" "$URL" 2>&1)
STATUS=$(echo "$HTTP_CODE" | awk '{print $1}')
TIMING=$(echo "$HTTP_CODE" | awk '{print $2}')
echo " player_id=$player_id http=$STATUS time=${TIMING}s" | tee -a "$OUTFILE"