App is grindingly slow on iOS

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Aduro91
Posts: 45
Joined: Sat Jul 22, 2023 8:49 pm

App is grindingly slow on iOS

Post by Aduro91 » Fri Jan 03, 2025 8:47 pm

Hey all,

My app is fine with other cards on iOS but one card is grindingly slow.

It has a gif in the background, which is an image drawn from copy files (resources folder). This shouldnt be a problem because it was already slow when it was entirely failing to source the image from my desktop, before I changed the code for the standalone.

The only other things on the card are a very small gif, some basic graphics, quite a few text fields, one table field with ONE row of information, and two text fields that go up the screen like credits.

This code is the only thing running after some initial work when opening the card:

Code: Select all

on rollcredits
   if the top of field "castnamescredits" < -(field "bonusline" * 17.2) then
      show graphic "bonusindicate"
   else
      hide graphic "bonusindicate"
   end if
   if the bottom of field "castcredits" > 0 then
      set the top of field "castcredits" to the top of field "castcredits" - 1
      set the top of field "castnamescredits" to the top of field "castnamescredits" - 1
      if field "bonuscolourline" < 56 then
         add 1 to field "bonuscolourline"
         set foregroundcolor of line (field "bonusline") of field "castnamescredits" to line (field "bonuscolourline") of field "bonuscolour"
      else
         set foregroundcolor of line (field "bonusline") of field "castnamescredits" to line 1 of field "bonuscolour"
         put 1 into field "bonuscolourline"
      end if
      send rollcredits to me in 40 milliseconds
   end if
end rollcredits
It just moves the text fields and makes a certain line shine, whilst showing people if they have passed a bonus they would need to rewind for.

Any idea why it is a 1 change per second slideshow on iOS when it runs perfectly fine on the desktop Livecode editor and I have done similar apps without this issue?

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7344
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: App is grindingly slow on iOS

Post by jacque » Sat Jan 04, 2025 6:40 pm

Almost every command requires a screen redraw which is visually expensive. Try locking the screen at the beginning of the handler and unlocking at the end. Let us know if that isn't enough.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Aduro91
Posts: 45
Joined: Sat Jul 22, 2023 8:49 pm

Re: App is grindingly slow on iOS

Post by Aduro91 » Tue Jan 07, 2025 8:24 pm

Thanks for the advice turns out it was a gif that was much larger than I thought it was! thanks!

Post Reply

Return to “Talking LiveCode”