Skip to content

CircuitPython v8.0.0-beta.2: display_shapes.polygon color fill is rendering very slowly #57

Closed
@CedarGroveStudios

Description

@CedarGroveStudios

Compared to v7.3.3, polygon color fill during instantiation of the triangle display shape runs significantly slower in v8.0.0-beta.0. The rendering time for a filled triangle in v7.3.3 is about 1.8 seconds compared to 161 seconds in v8.0.0-beta.0. It also appears that the border fill is taking longer, 4.7 seconds versus 0.4 seconds. Also interesting that instantiating an object without a fill and border takes 25 times longer.

When pausing the execution during rendering, the trace shows that it's spending the majority of the time in polygon.py. I haven't had the opportunity to trace the issue further into the polygon.py code and hope that there may have been a recent change that could be reversed or corrected.

Here's the PyPortal Titano test code:

import board
import time
import displayio
from adafruit_display_shapes.triangle import Triangle

display = board.DISPLAY
#triangle_group = displayio.Group()

width = display.width
height = display.height
print(f"width: {width}  height: {height}")

t0 = time.monotonic()
print("triangle_1: ", end="")
triangle_1 = Triangle(
    width,
    height,
    0,
    0,
    0,
    height,
    fill=None,
    outline=None,
)
print(time.monotonic() - t0)

t0 = time.monotonic()
print("triangle_2: ", end="")
triangle_2 = Triangle(
    width,
    height,
    0,
    0,
    0,
    height,
    fill=0x111111,
    outline=None,
)
print(time.monotonic() - t0)

t0 = time.monotonic()
print("triangle_3: ", end="")
triangle_3 = Triangle(
    width,
    height,
    0,
    0,
    0,
    height,
    fill=None,
    outline=0x111111,
)
print(time.monotonic() - t0)

The 7.3.3 results:

Adafruit CircuitPython 7.3.3 on 2022-08-29; Adafruit PyPortal Titano with samd51j20
>>> 

code.py output:

width: 480  height: 320
triangle_1: 0.0019989
triangle_2: 1.771
triangle_3: 0.410995

The 8.0.0-beta.0 results:

Adafruit CircuitPython 8.0.0-beta.0 on 2022-08-18; Adafruit PyPortal Titano with samd51j20
>>> 

code.py output:
�]0;🐍code.py | 8.0.0-beta.0\
width: 480  height: 320
triangle_1: 0.0507813
triangle_2: 161.438
triangle_3: 4.66797

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions