Improved memory efficiency for some text updates to bitmap_label.Label #167
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.
bitmap_label.Label
- theself._bitmap
andself._tilegrid
is no longer recreated all the timeBitmap
(andTileGrid
) using more memory briefly and potentially causing memory fragmentation.self._prev_label_direction
to supportlabel_direction
properly.label_direction
forRTL
which would toggle direction if the value was repeatedly set - text reversal is now performed as text is set and not stored._replace_tabs()
function also enhanced to only do split/join if tabs are present - this is probably a rare case and it's inefficient to be making new text strings all the time.The most efficient updates are now if the text string is the same character length as the previous value. The bitmap is cleared with
fill(0)
and re-written and this can cause flicker. The cognoscenti will be controlling display refresh, of course.