adafruit/Adafruit_CircuitPython_Display_Text

Updates to text are inefficient for special case of same length and width text

kevinjwalters opened this issue · 3 comments

This library allocates a lot of new objects when none is needed for text updates of the same length where the overall text is also the same width. This can lead to memory fragmentation and eventual failure of code which tries to efficiently update an existing Label's text property as recommended in Adafruit Learn: CircuitPython Display_Text Library: Label Updating.

I've got some simple fixes for this but I need to check them...

I've just put in a PR (#167) for this. I've been using it and testing it with two applications I use but there's a huge amount of functionality to test here.

How's testing been done on Label in the recent past?

Adafruit Learn: CircuitPython Display_Text Library: Label Updating could be updated to state explicitly that the most efficient updates are ones where the text length is the same length, perhaps with an example showing a formatted string designed to be a fixed length via padding.