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

fix: improve performance of connecting blocks #6876

Merged
merged 11 commits into from
Mar 16, 2023

Conversation

BeksOmega
Copy link
Collaborator

@BeksOmega BeksOmega commented Mar 2, 2023

The basics

  • I branched from develop
  • My pull request is against develop
  • My code follows the style guide
  • I ran npm run format and npm run lint

The details

Resolves

Related to #6130

Proposed Changes

Optimizes the performance of connecting blocks by:

  • Removing unnessary calls to updateDisabled
  • Only setting the parent once (when connecting) instead of twice (when connecting and disconnecting)

Reason for Changes

Cuts off ~100ms from wrapping an if block around the spaghetti code test blocks.

Test Coverage

Only manual testing :/

Documentation

N/A

Additional Information

Dependent on #6860

@BeksOmega BeksOmega requested a review from a team as a code owner March 2, 2023 21:51
@github-actions github-actions bot added the PR: fix Fixes a bug label Mar 2, 2023
@BeksOmega BeksOmega marked this pull request as draft March 2, 2023 21:52
@github-actions github-actions bot added PR: fix Fixes a bug and removed PR: fix Fixes a bug labels Mar 2, 2023
When disconnecting the last block in the stack, the block would not be
rerendered correctly (the top-start corner would not be reshaped)
The order for applying connections was changed so that connections were
applied and then the insertion marker was hidden. This caused an error
because hiding the insertion marker expected there to be a child block
when there was not.
@BeksOmega BeksOmega marked this pull request as ready for review March 8, 2023 16:02
@BeksOmega
Copy link
Collaborator Author

@NeilFraser This is ready for a look! Might be advisable to review this commit-wise.

core/block_svg.ts Show resolved Hide resolved
core/insertion_marker_manager.ts Show resolved Hide resolved
core/connection.ts Show resolved Hide resolved
throw Error('Source connection not connected.');
}
if (otherConnection.targetConnection !== this) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This used to double-check that the connections actually point at each other. Why did you remove that check?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It seems a bit silly when we have the connectReciprocally method. If this check errors, afaict it just means we coded a bug (or someone messed with targetConnection directly, which is also our failing for making that public). Imo, these assertions should be covered by unit tests, not code. But I may be missing some context here.

core/connection.ts Show resolved Hide resolved
core/rendered_connection.ts Show resolved Hide resolved
core/insertion_marker_manager.ts Show resolved Hide resolved
@BeksOmega BeksOmega merged commit c2919c5 into google:develop Mar 16, 2023
Copy link
Contributor

Choose a reason for hiding this comment

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

ConnectionType is now unused, and you missed the lint warning (but now we can all enjoy it! 🤣)

@BeksOmega BeksOmega deleted the fix/wrapping-performance branch May 3, 2023 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: fix Fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants