Slow stack needs speed

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
RossG
Posts: 247
Joined: Thu Jan 08, 2015 7:38 am

Slow stack needs speed

Post by RossG » Sat Oct 01, 2016 12:37 am

Attached a stack which I would like to go faster.

I guess that re-building the array in each of the
functions ROTT16 to ROTT36 is the bottle-neck.

Load a file - some samples included.

Suggestions welcome.
Attachments
SM Explicator v1.4.zip
(18.41 KiB) Downloaded 256 times
Is age an excuse? Eighty-four and counting.
Programming powered by coffee.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10323
Joined: Wed May 06, 2009 2:28 pm

Re: Slow stack needs speed

Post by dunbarx » Sat Oct 01, 2016 4:30 am

I am going to have to at least keep a v8 LC around. So many queries involve stacks I cannot open.

Sorry. But someone will chime in soon

Craig Newman

RossG
Posts: 247
Joined: Thu Jan 08, 2015 7:38 am

Re: Slow stack needs speed

Post by RossG » Sat Oct 01, 2016 7:46 am

Craig

LC 7.1.2 should do it.
Is age an excuse? Eighty-four and counting.
Programming powered by coffee.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10050
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Slow stack needs speed

Post by FourthWorld » Sat Oct 01, 2016 5:59 pm

@Ross: I can often make time to revise code that may benefit from optimization, but your apps has hundreds of controls and no clear path to focus on. I started to look in one button script, but found that it was sending messages to some 36 other buttons that I can't find there. Not sure how to meaningfully proceed, but while I was poking around I found a few things that will likely boost performance by at least an order of magnitude:
- Within loops, work in variables rather than on the field directly; put the result into the field when the loop is done; field operations are FAR more expensive than variables.
- Use the "repeat for each" loop form instead of "repeat with i = 1 to..." wherever practical.

These are other tips are outlined here, a wonderful thread that wound up covering a wide range of useful optimization tips that brought a routine that used to take 9 minutes down to a few milliseconds:
http://forums.livecode.com/viewtopic.php?f=8&t=24945


@Craig: v7 is generally much slower than v6 or v8.1. Since v8.1 includes some 2800+ enhancements and fixes not found in the now-discontinued v6, and several hundred since the last of the now-discontinued v7 series, it's an efficient and robust option. And since it's currently maintained, it's arguably the best option for work going forward, since OS APIs change frequently and engine updates will be needed to stay on top of those.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply