Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .jules/bolt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

## 2026-05-19 - Defer dictionary allocation in orbital pass loop
**Learning:** Generating dictionaries and formatting datetime strings in a tight loop where the result is immediately discarded for >90% of iterations creates a massive, unnecessary performance bottleneck.
**Action:** Always defer expensive object allocations and string formatting operations until *after* filtering conditions (like visibility checks) have passed.
15 changes: 8 additions & 7 deletions backend/api/routers/orbital.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,15 @@ async def get_passes(
r_ecef = teme_to_ecef(r, jd, fr)
az, el, rng = ecef_to_topocentric(obs_ecef, r_ecef, lat, lon)

point = {
"t": t.strftime("%Y-%m-%dT%H:%M:%SZ"),
"az": round(az, 2),
"el": round(el, 2),
"slant_range_km": round(rng, 3),
}

if el >= min_elevation:
# Defer string formatting and allocation until we know satellite is visible
point = {
"t": t.strftime("%Y-%m-%dT%H:%M:%SZ"),
"az": round(az, 2),
"el": round(el, 2),
"slant_range_km": round(rng, 3),
}

if not in_pass:
in_pass = True
current_pass_points = []
Expand Down
Loading