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

Faster text layout #356

Merged
merged 2 commits into from Jul 5, 2020
Merged

Faster text layout #356

merged 2 commits into from Jul 5, 2020

Conversation

amolenaar
Copy link
Member

@amolenaar amolenaar commented Jul 3, 2020

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Documentation content changes

What is the current behavior?

Issue Number: N/A

What is the new behavior?

This PR improves the speed of text rendering by about a factor 10. Now Pango layouts are not created all the time, but they are reused. This saves a huge amount of time.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jul 3, 2020

Sourcery Code Quality Report (beta)

✅ Merging this PR will increase code quality in the affected files by 0.0 out of 10.

Before After Change
Quality 8.69 8.69 0.0
Complexity 1.3 1.33 0.02
Method Length 52.61 52.44 -0.18
Lines 1337 1330 -7
Changed files Quality Before Quality After Quality Change
gaphor/UML/classes/association.py 8.71 8.71 -0.0 ⬇️
gaphor/diagram/shapes.py 8.74 8.73 -0.01 ⬇️
gaphor/diagram/text.py 7.74 8.13 0.39 ⬆️
gaphor/diagram/tests/test_shapes.py 9.16 9.16 0.0
gaphor/diagram/tests/test_text.py 8.75 8.44 -0.31 ⬇️

Here are some functions in these files that still need a tune-up:

File Function Quality Recommendation
gaphor/UML/classes/association.py AssociationEnd.post_update 3.65 Split out functionality
gaphor/UML/classes/association.py AssociationItem.post_update 4.72 Split out functionality
gaphor/diagram/text.py _text_point_at_line_end 4.74 Split out functionality
gaphor/diagram/text.py _text_point_at_line_center 5.62 Split out functionality
gaphor/diagram/shapes.py IconBox.child_pos 6.11 Split out functionality

Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Let us know what you think of it via email or our Gitter!

Copy link
Member

@danyeaw danyeaw left a comment

Choose a reason for hiding this comment

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

Nice cleanup and optimization!

@amolenaar amolenaar merged commit 049c9a4 into master Jul 5, 2020
@amolenaar amolenaar deleted the faster-text-layout branch July 5, 2020 15:19
@danyeaw danyeaw added the feature A new feature label Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants