Runs super slowly

Bringing your stacks to the web

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
cwkalish
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 78
Joined: Thu Sep 30, 2010 2:24 am

Runs super slowly

Post by cwkalish » Tue Aug 16, 2016 6:09 pm

I've tried my first html5 standalone, and I find it runs achingly slowly. All it does is toggle which images in a group are visible. I've pasted some of the code (of a button) below. The images switch very slowly and I get a spinning beachball between redraws (on an iMac)

I've only tested opening the file on my computer, not actually served over the web, but that should only make things worse?
The example scripts I've seen run quite smoothly. Am I missing something?

Thanks.
-Chuck

on mouseUp
send "resetmonster" to me
put "bottoms,eyes,horns,mouths,tops,wings,labels" into tinfo
repeat with x = 1 to 7
put item x of tinfo into tfeat
put random(2) into m1level

put tfeat&m1level into m1feat
set the visible of image m1feat of grp "monster1" to true
--the monsters are composed of features like bottoms1 eyes2, etc.
end repeat

end mouseUp

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Runs super slowly

Post by [-hh] » Tue Aug 16, 2016 7:10 pm

These are, from my experiences, roughly the slow-down-factors (from IDE 8 to latest versions of the webbrowsers) you can currently await:
Safari 3, Firefox 6 and Chrome 10.

When displaying images this usually works good for me:

Code: Select all

on mouseUp
  lock screen; lock messages
  ...
  unlock screen; unlock messages
end mouseUp
Also checking "preload in memory" of the images has shown improvements here.
shiftLock happens

cwkalish
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 78
Joined: Thu Sep 30, 2010 2:24 am

Re: Runs super slowly

Post by cwkalish » Tue Aug 16, 2016 7:33 pm

Thanks for the reply. Locking the screen did help considerably, but there's still a pretty strong lag.

In your list of slow-down-factors, Safari gets 3, does that mean it is the fastest? I was testing with Safari. I hope it doesn't get slower than that.

Also, preloading into memory means selecting "buffer" in the property inspector or setting "alwaysbuffer" to true?

In the actual app I'll mostly be setting button icons, I hope that's faster ;-)

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Runs super slowly

Post by [-hh] » Tue Aug 16, 2016 8:04 pm

Yes, a slow-down-factor f of a browser means that 10 ms in the IDE become f*10 ms in the browser.
Until two months before the slow-down-factors were roughly: Firefox 5, Safari 8 and Chrome 15.
So Safari made the biggest improvement, but if user uses still MacOS < 10.11 ...

If you wish for example to display a digital clock every full second in all main 'newer' browser versions, your handler has to be done in less than 70 ms in the IDE.

There is moreover some slow-down by the fact that browsers have a refresh rate of up to 3 ticks (48 ms).

My working method is to do a timing of the main handlers, then I know where I have to improve in the IDE.
Good luck, I hope also for you that your buttons will display fast ...

[p.s. With preloading into memory I meant setting alwaysbuffer of the image to true].
shiftLock happens

Post Reply

Return to “HTML5”