Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(app): hoist getLabwareDefsFromCommands outside of each protocol command text #16478

Merged
merged 1 commit into from
Oct 14, 2024

Conversation

mjhuff
Copy link
Contributor

@mjhuff mjhuff commented Oct 14, 2024

Overview

After #16451, it seemed like a good idea to do an audit of our O(n) getLabwareDefinitionsFromCommands util to see if we could improve performance elsewhere in the app. Turns out, pretty much every place that it's used has room for improvement (mainly in the case handled by this PR and in LPC flows).

One such place is within each protocol command text. When we display a list of protocol command texts, for every protocol step associated with a labwareId, we iterate over the entirety of protocol analysis. This PR acts as a half-measure: hoist out the util far enough to reduce most of the negative performance implications.

While we could go farther and really clean this up, I think this is a happy-medium for now. Here is a sustaining ticket for addressing this problem more permanently.

The actual file of interest is app/src/molecules/Command/utils/getLabwareDisplayLocation.ts. Everything else is really just refactoring around that hoisting.

Test Plan and Hands on Testing

  • Smoke tested the app. It's working.

Risk assessment

lowish-medium - We're pretty well covered by tsc checks.

@mjhuff mjhuff requested a review from a team as a code owner October 14, 2024 14:47
@mjhuff mjhuff changed the title refactor(app): hoist getLabwareDefsFromCommands outside of each proto… refactor(app): hoist getLabwareDefsFromCommands outside of each protocol command text Oct 14, 2024
Copy link
Member

@sfoster1 sfoster1 left a comment

Choose a reason for hiding this comment

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

Looks good as long as it's just a list of loaded definitions - I think this approach will stop working once we get to things that change over the course of the run, or at least will need a slightly different approach.

@mjhuff mjhuff merged commit d3cb154 into edge Oct 14, 2024
35 of 36 checks passed
@mjhuff mjhuff deleted the app_hoist-lw-defs-from-command-text branch October 14, 2024 20:55
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