Improve: make text wrapping quicker#6277
Merged
vadi2 merged 2 commits intoMudlet:developmentfrom Sep 6, 2022
Merged
Conversation
Avoided duplicate call to horizontalAdvance, basically skip the first call since it was called before the function is called
|
Hey there! Thanks for helping Mudlet improve. 🌟 Test versionsYou can directly test the changes here:
No need to install anything - just unzip and run. |
vadi2
approved these changes
Sep 2, 2022
Member
|
LGTM. Will give others a few days to review and then we merge :) |
Member
|
I mentioned in discord but a 1000000 line test shows ~18% reduction in overall time taken to process. |
demonnic
added a commit
that referenced
this pull request
Nov 14, 2022
#### Brief overview of PR changes/additions #6207 and subsequently #6277 have since been discovered to be the source of several bugs, and so we have decided to revert the changes in development but open a new PR for the changes themselves. #### Motivation for adding to Mudlet #### Other info (issues closed, discussion etc) resolve the following issues: #6416 #6394 #6321 #6290 Co-authored-by: Kebap <kebap_spam@gmx.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Avoided duplicate call to horizontalAdvance, basically skip the first call since it was called before the function is called
Brief overview of PR changes/additions
horizontalAdvance is an expensive call, current implementation in binarySearchHorizontalAdvance has a duplicate call that happen when the function is called for the first time for the line being wrapped. This PR avoided that.
Motivation for adding to Mudlet
This would have reduce the horizontalAdvance call for line that needs to be wrapped as follow:
Wrapped 1 time : 50%
Wrapped 2 times : 33.3%
Wrapped 3 times : 25%
Wrapped 4 times : 20%
Wrapped 5 times : 16.6%
Wrapped 6 times : 14.28%
Wrapped 7 times : 12.5%
Basically, 1/(wrapped times + 1).
Other info (issues closed, discussion etc)