• I have found 2 huge improvements:

    1. Collapsing the tree into a flat array on the browser side saves about 50% rendering time on the watch. That might complicate further savings using partial redraws, but that's currently just an idea.
    2. Using g.transformVertices for drawing the rotated analog vector hands. About 30% faster while drawing those.

    I have added expensive code for tracking time, so the absolute times are inflated a lot by that. The overview of the tracked times can be printed with printPerfLog(). With deactivated time tracking it is still a bit to slow for amazfit watchfaces with seconds. It however is a lot closer to sub second rendering than before.

    ...
    drawImage last: 88 average: 86 count: 2 total: 173
    drawIteratively last: 282 average: 282 count: 1 total: 282
    drawIteratively_handling_Image last: 97 average: 99 count: 2 total: 198
    drawIteratively_handling_Poly last: 62 average: 62 count: 1 total: 62
    

    In this example the two drawIteratively_handling_Image take 25ms longer than the two drawImage call they wrap. The logging uses about 8ms per stored element (startPerfLog and endPerfLog combined).
    It seems the remaining 4.5 ms per call have been used by an if checking an object property, a switch statement and the function call to my drawImage function.
    Is that expected? 4.5 ms at 64MHz would be about 280k instructions, that seems somewhat excessive to me 😉.


    1 Attachment

About

Avatar for halemmerich @halemmerich started