Loop time and renderer:renderPolyline with points widely outside the screen size

  • borisff
  • borisff's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 65
  • Thank you received: 3

TPL_KUNENA_MESSAGE_CREATED Loop time and renderer:renderPolyline with points widely outside the screen size

17 Oct 2021 16:49 - 17 Oct 2021 16:50
#1
LUA addPoint isn't protected against points widely outside the screen, so
the time between the loop calls can be very high on a real transmitter when using
renderer:renderPolyline.

Attached example
when run on emulator, loop time is 21ms
when run on DC-24, Loop time stabilizes near 660ms.

Attachment looptime.lua not found

Last edit: 17 Oct 2021 16:50 by borisff.

Please Log in or Create an account to join the conversation.

  • LeonAir
  • LeonAir's Avatar
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 57
  • Thank you received: 58

TPL_KUNENA_MESSAGE_REPLIED_NEW Loop time and renderer:renderPolyline with points widely outside the screen size

17 Oct 2021 18:04
#2
Does lcd.setClipping or renderer:setClipping improve the performance? (fixed some typos btw)

Attachment looptime.lua not found


In either case it's an indicator for poor optimization.

Please Log in or Create an account to join the conversation.

  • borisff
  • borisff's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 65
  • Thank you received: 3

TPL_KUNENA_MESSAGE_REPLIED_NEW Loop time and renderer:renderPolyline with points widely outside the screen size

18 Oct 2021 12:19 - 18 Oct 2021 12:29
#3
The version with lcd.setClipping and ren::setClipping gives on DC-24 850ms (!) loop time in it's .lc form. Doing the setClipping in the tprint once at first run, same behavior.
When using a more reasonable out of screen addPoint(310 * 2, 160 * 2) delay is 20ms with the setClipping.

I found the bug giving very wide y values in my real app on a particular case using a function checkPoint(x, y) called before any addPoint(x,y)
local function checkPoint(x, y)
if (x < 0 or x > app.width) then
print(lFormat(app.Name .. " Bad x=%d",x))
end
if (y < 0 or y > app.height) then
print(lFormat(app.Name .. " Bad y=%d",y))
end
end

l
Last edit: 18 Oct 2021 12:29 by borisff.

Please Log in or Create an account to join the conversation.

  • davidmcq137
  • davidmcq137's Avatar
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 79
  • Thank you received: 87

TPL_KUNENA_MESSAGE_REPLIED_NEW Loop time and renderer:renderPolyline with points widely outside the screen size

19 Oct 2021 02:57
#4
I have seen the same thing and done the same defense. Have you also noticed that when setting a small clip window on the screen it moves it over by the size of the clip window from the place you specified?

Please Log in or Create an account to join the conversation.

  • Raf
  • Raf's Avatar
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 141
  • Thank you received: 192

TPL_KUNENA_MESSAGE_REPLIED_NEW Loop time and renderer:renderPolyline with points widely outside the screen size

19 Oct 2021 11:58
#5
When you set clipping, the X/Y coordinates will be relative to the clipped window/rectangle.
Voltario T30, Touch Switch, MicroVario, AMS, SE6

Please Log in or Create an account to join the conversation.

  • davidmcq137
  • davidmcq137's Avatar
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 79
  • Thank you received: 87

TPL_KUNENA_MESSAGE_REPLIED_NEW Loop time and renderer:renderPolyline with points widely outside the screen size

19 Oct 2021 12:47
#6
Ah! So the bug is me, not Jeti .. nice :-)

Please Log in or Create an account to join the conversation.

Time to create page: 0.315 seconds
Powered by Kunena Forum