Lots or Few

Help creating logic scripts for Air Manager Instruments

Moderators: russ, Ralph

Post Reply
Message
Author
User avatar
Keith Baxter
Posts: 4685
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Lots or Few

#1 Post by Keith Baxter »

Hi,

@Corjan In the instrument I am doing there am many canvas_add()

What is better?
1) Lots of canvas_add() with lots of visible() and few canvas_draw().
2) Few canvas_add() with lots of visible() and lots of canvas_draw()
3) Does the size of the canvas make a difference if only a small part of the canvas is used?

My canvas_add() count is over 100. Not all are drawn many times. Most moved, rotated and made visible or not.

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
Corjan
Posts: 2939
Joined: Thu Nov 19, 2015 9:04 am

Re: Lots or Few

#2 Post by Corjan »

Hi,


1) Very fast
2) canvas_draw is expensive compared to visible/rotate/move/viewport/opacity.
3) No

In general, try to segment your code the best possible. So multiple small canvasses/subscriptions.
Aggregating a lot of data together in one subscription will make that callback being called a lot. And if you have a big canvas in the callback, that also has to be completely redrawn every time. That can become expensive.


Corjan

User avatar
Keith Baxter
Posts: 4685
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Lots or Few

#3 Post by Keith Baxter »

Corjan wrote: Sat Nov 21, 2020 1:57 pm Hi,


1) Very fast
2) canvas_draw is expensive compared to visible/rotate/move/viewport/opacity.
3) No

In general, try to segment your code the best possible. So multiple small canvasses/subscriptions.
Aggregating a lot of data together in one subscription will make that callback being called a lot. And if you have a big canvas in the callback, that also has to be completely redrawn every time. That can become expensive.


Corjan
Awesome, Thank you Corjan.

What I was thinking.

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

Post Reply