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

g.Rect: performance improvement when using Manhattan router with Rect shapes #2319

Merged

Conversation

coyoteecd
Copy link
Contributor

Description

Rect.containsPoint is called many times with a Point instance as argument. Avoiding the new Point() call improves loading times significantly on large papers.

Motivation and Context

Our app uses Manhattan router with shapes and links. We've had performance issues when loading a larger paper, due to the time spent performing layout. One of the issues was that the routing logic calls Rect.containsPoint many, many times (thousands), and this function constructs a new Point every time it is called. But, the argument it gets is already a Point instance, so creating a copy just for the comparison is not necessary.

… shapes

Rect.containsPoint is called many times with a Point instance as argument.
Avoiding the new Point call improves loading times significantly on larger papers.
@kumilingus kumilingus merged commit b8b8d9d into clientIO:master Aug 31, 2023
3 checks passed
@kumilingus
Copy link
Contributor

Thanks!

@coyoteecd coyoteecd deleted the bugfix/point-comparison-performance branch September 21, 2023 13:56
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