Special Graphic Effects - Kill Performance On Rapid Redraws

Sannyasin Brahmanathaswami brahma at hindu.org
Tue Nov 19 12:59:35 EST 2019


We released SivaSiva 1.6.  Just yesterday.

The days before release I found a "bug" I had introduced in performance which may be useful, especially to newbies, because in using xTalk for 20 years, even I did not this.

One of the thing I have learned is how "bad" special graphic effects are on mobile that require redrawing of the screen. Hopefully others can add to these meager insights…

In the explanation for effective scrolling layers/datagrid that Mark W. made, one of the things was that the scrolling layer cannot have any graphic effect applied to any of the objects of the "rows" or re-iterated groups the scroll.

Taking that as a clue, in the Color Meditation module, for example, -- which always behaved badly, especially on Android, has no scrolling groups--  I had an outer glow on 3 different fields that were being updated on a timer. "Inhale 1" "Inhale 2" etc.   I could never got the "Pause" button to stop it. After I refactored the code, not to use repeat loops (which as hard to interrupt, even with boolean flags ), but use "send ### in ### time"  it improved slightly but was still slow.

I took away the outglow in the fields that are redrawn ever second, set the textcolor to "black"-- all of a sudden it worked "brilliantly" on Android!  No performance issues…"Sheesh, what a simple solution"

I guess most of the old timers know this, but clearly the "paint" routine in the engine does want *any* special effects on object that require constant redrawing on the screen.  So this requires a UI design that use "flat" objects for everything that would be a performance issue on rapid motion or screen updates: no only on the datagrid and scrolling groups, which was Mark's "theme" in the explanation.

I would be good to put this all into some kind of "lesson" on the web site. Since the scope could be "anywhere" I would make it a part of

"Use of Special Graphic Effects in Livecode"  (maybe already there?)

and there you could have a guide and where *not* to use them, as well as explanation of the different kinds of layer modes that are important.

I would happen to contribute such a lesson, at least a first draft

Also, I don't think this is an LC issue, one never sees things like drop shadow and outglows etc. on anything in other apps on iOS and Android. I looked through a lot all apps. Anything that "moves", usually, has flat objects.

BR



More information about the use-livecode mailing list