Skip to content

performance: Move API calls out of render and into subway_status - #3408

Merged
jlucytan merged 17 commits into
mainfrom
jlt/perf/move-api-calls
Aug 21, 2026
Merged

performance: Move API calls out of render and into subway_status#3408
jlucytan merged 17 commits into
mainfrom
jlt/perf/move-api-calls

Conversation

@jlucytan

@jlucytan jlucytan commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Scope

Asana Ticket: 📈 🛠️ [Subway Status] Move API calls / stop-loading out of component-rendering

Implementation

Moves affected_stops and endpoint_stops out of status_row_heading and into subway_status so there are fewer API calls at render time on the home page, and the data is cached.

The alerts page and schedule finder still make calls to populate the subheading for the Planned Work section, however.

Although commuter_rail_upcoming_changes also utilizes the status_row_heading component, I don't believe it currently shows any subheadings, so no data is added there.

Screenshots

Should have no visual changes.

Old flamegraph:
flame-main-content-tag-blue

New flamegraph:
flame-branch-content-tag-blue

How to test

Homepage, alerts page, schedule finder alert banners, commuter rail upcoming changes appearances should not change between this branch and prod.

@jlucytan
jlucytan marked this pull request as ready for review August 13, 2026 14:18
@jlucytan
jlucytan requested a review from a team as a code owner August 13, 2026 14:18
@jlucytan
jlucytan requested a review from joshlarson August 13, 2026 14:18

@joshlarson joshlarson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like what I see so far, and having these calls not run per-component-load is going to be a huge win!

However, I think something's gone a bit wrong with combining subheadings. Compare dev-green on the left to this branch on the right.

Image

It looks like status on the alerts page is combining subheadings from different rows even when the rows themselves aren't being combined, but on that page, each row should only show the affected stops or endpoints from the alert associated with that row.

Comment thread lib/dotcom_web/components/system_status/status_row_heading.ex Outdated
Comment thread lib/dotcom_web/components/system_status/subway_status.ex Outdated
Comment thread lib/dotcom_web/components/system_status/subway_status.ex
@jlucytan
jlucytan requested a review from joshlarson August 19, 2026 13:34

@joshlarson joshlarson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, and when running locally and looking at flamegraphs, I was seeing a consistent improvement of about 70ms (rendering going from ~268ms to ~198ms), which is HUGE. Plus, hand-wavy-guess it wouldn't shock me if this was also one of the more memory-consuming parts of individual page loads, which makes this even more impactful.

I left some stylistic feedback, but none of it is blocking, and can all be addressed as follow-ups, if at all.

Comment thread test/dotcom_web/components/system_status/subway_status_test.exs Outdated
Comment thread lib/dotcom_web/live/schedule_finder_live.ex
Comment thread lib/dotcom/system_status/subway.ex Outdated
Comment thread lib/dotcom/system_status/subway.ex Outdated
@jlucytan
jlucytan requested a review from joshlarson August 20, 2026 14:38
@jlucytan
jlucytan enabled auto-merge (squash) August 21, 2026 13:51
@jlucytan
jlucytan merged commit 04cc0e3 into main Aug 21, 2026
26 checks passed
@jlucytan
jlucytan deleted the jlt/perf/move-api-calls branch August 21, 2026 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants