avoiding frame drop when using JSUI with many elements
Hi & happy new years,
I’m actually working on a gui that could display a large amount of numbers and visual indications at high framerate. I mean 96 slots each composed by 5 rectangles and 2 texts zones.
Any way I try result in a dramatic framedrop and even a basic metro object at 44 hz drops at 20 hz. Any clues on how to optimise this kind of gui tasks ?
- This topic was modified 4 months by siteswapjuggler.
Hi .what do you mean by high framerate ? how do you provide a framerate for jsui anyway ? banging it ?
I attached my patcher to me clearer, the jsui provide me a display linked to a matrix and different parameters with different zones reactive to mouse actions. The whole display is refreshed by a metro at 40 hz in order to keep the display update and to output the data stream (DMX data actually). The jit.fpsgui give me an approximation of the data output framerate.
It actually drop when I’m in editing mode, when I start the stress test (a simulation of every channel being constantly moved at the same time) or when I move the values manually very quickly.
On my windows desktop computer the drop is very little from 40 fps to 35 fps. But on my Mac Book Pro it drops from 40 to 20 fps which become noticable actually and I already have deactivated the retina rendering for Max. With retina activated it goes to 12 fps in stress condition.
In any of those situation if I switch off the mgraphics.redraw() of everything works well again, same thing if I make it draw less than 50 shapes. Going thru an instance of MGraphics before rendering to the surface via an Image doesn’t change anything.
I also tried to generate native object via scripts methods and then talk to the different named objects but the result is the same (== framedrop). And I tried to display the information into an LCD with a standard JS generating the commands to draw and same thing (== framedrop again).
hmmm . i heard about retina problems already , also about different performance on mac (so perhaps thats normal issue). cant say anything useful here . your patch works realaxed on my desktop machine . i must try hard to drop it to 36fps . ive got 38 – 40 fps constantly , even if i change , edit or touch your numbox .
one thing that may cause jsui to work harder are curves . your rounded boxes needs more cycles . try to prove if you will get better results with regular rectangles in your mgraphics scenario .
i can tell that you will see the difference but not sure how big it will be as you dont do much with positioning them (are static ). ive tested it on my own already with 360 boxes , but my boxes have been suited for drag and drop , so thats different story i guess .
edit. cant check "stress" as there is poly that wasnt included here
you said that youve tried to draw your surface with an image . this should help with the rectangles . but constantly updated numbers would be drawn as metro hits it anyway . if u will decrease framerate, will you see huge fps difference ? JS doesnt like fast messages , something is queuing in its thread , jit.matrix . i cant be sure here
Thanks for the answer, it helps a lot to have new views on the subjects. Rounded and not rounded square doesn’t seems to change that much (1 to 2 fps better with normal squares).
I will try a last method based on layers. A background lcd for non changing graphics, a low refreshed JSUI for low priority changes and a high framerate JSUI nor a jit.cellblock for numbers.