Performance when multitasking

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

tperry2x
Posts: 23
Joined: Wed Apr 22, 2020 9:58 pm

Performance when multitasking

Post by tperry2x » Wed Apr 22, 2020 10:13 pm

Hi everyone. This is my first post on Livecode Forums, and I hope someone will have an answer.
I've noticed a large difference between performance on mac, linux and windows.

Namely, if I have multiple animations going on at once.
Windows and Linux seem to handle it well without much if any slowdown.

The mac however, lags something chronic.
(These are all tested on the same hardware). In fact, they are all on VMs on the same computer.

Here's a screenshot of what I mean.
My stack measures what the maximum performance could be with nothing moving when opened.
If you then turn on the 'green', 'red' and 'yellow' checkboxes you should see animations begin.
The performance impact of this is shown in the figures and the graph above the animation.

So my question is why the disparity between platforms? Is there a setting I need to turn on for MacOS that I don't know about?

Many thanks for anyone's help on this.
Kind regards,
Tom.

https://www.tsites.co.uk/downloads/live ... asking.zip

Image
Last edited by tperry2x on Thu Apr 23, 2020 8:33 pm, edited 3 times in total.

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

Re: Performance when multitasking

Post by FourthWorld » Wed Apr 22, 2020 10:21 pm

tperry2x wrote:
Wed Apr 22, 2020 10:13 pm
(These are all tested on the same hardware). In fact, they are all on VMs on the same computer.
Thank you thank you thank you. Most comparative benchmarks we see are on different hardware. This helps. Much appreciated.
So my question is why the disparity between platforms? Is there a setting I need to turn on for MacOS that I don't know about?
Hard to say. I know the Mac's Quartz compositor produces very pretty results, and "pretty" often means "computationally expensive".

Maybe also the VM inhibits some macOS optimizations?

I'm just guessing here. Hopefully we'll get some more informed feedback, or at least diagnostic guidance.

If the test machine a Mac? Might be interesting to see how well it does on native iron.

'd like to post stack or at least a screenshot, but can't work out how.
so type 3 w, a fullstop then tsites (dot co dot uk) (slash) downloads (slash) screenshot-comparison (dot) jpg
so type 3 w, a fullstop then tsites (dot co dot uk) (slash) downloads (slash) livecode_multitasking (dot) zip
(jeez, do I really have to do this!! :( )
Only for another nine more posts. With more than 10 posts URLs become allowed. It's a drag, yes, but you'd be surprised how much nefarious (often illegal and/or malware) links used to be spewed all over these forums before the 10-post rule was put in place.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

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

Re: Performance when multitasking

Post by FourthWorld » Wed Apr 22, 2020 10:24 pm

Is that a scrollbar object I see in the screen shots?

Does hiding or removing it improve performance?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

tperry2x
Posts: 23
Joined: Wed Apr 22, 2020 9:58 pm

Re: Performance when multitasking

Post by tperry2x » Wed Apr 22, 2020 10:29 pm

Thank you for checking it out, and for answering my attachment question. Thought I must be missing something.
Makes sense though.
(this is why I had to post them on my site in the end)
Anyway, I have builds available if that helps, or people are welcome to build from the stacks and run their own benchmarks with it. I'd be interested to see if others have the same results. If they do, then hopefully we can get some performance improvements on the mac side.

The test machine is a Mac. OSX 10 point 11. The VM's (Windows 10 and Xubuntu 19 point 10) are in VirtualBox. I have also run the OSX build on an OSX 10 point 10 VM and and OSX 10 point 7 VM for testing comparison with the same results. I also tried the OSX build on another mac, just in case it was something to do with my machine, and it did the same on a MacBook Pro.

I will test on a Windows 10 bare metal machine and see if that does the same thing.
Many thanks everyone who looks at this and can shed more light on it.

Kind regards,
Tom.

tperry2x
Posts: 23
Joined: Wed Apr 22, 2020 9:58 pm

Re: Performance when multitasking

Post by tperry2x » Wed Apr 22, 2020 10:33 pm

Just tested the scrollbar hidden / visible idea.
With the scrollbar (progress bar) hidden, it gives me a rating of 1523 used and shown it increases to 1611.
So yes, you are quite right - there is a small performance hit with having this visible (It's something else to update after all), but it doesn't make up for the variation unfortunately.
Also, the scrollbar is visible on the other platforms too and has no noticeable performance impact.

I'm open to suggestions though.

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Performance when multitasking

Post by bogs » Wed Apr 22, 2020 11:00 pm

First, your links -
http://www.tsites.co.uk/downloads/scree ... arison.jpg
http://www.tsites.co.uk/downloads/livec ... asking.zip

Second - I didn't notice any use of 'lock screen' or 'lockscreen'. If your moving stuff around, probably a good idea to stop the screen painting from happening.

We had a REALLY good demo of animation around here a while ago, I'll have to see if I can find that thread. Pretty sure it featured a tiger running, phenomonal job. Lots of good tips and like that in it too.
Image

tperry2x
Posts: 23
Joined: Wed Apr 22, 2020 9:58 pm

Re: Performance when multitasking

Post by tperry2x » Thu Apr 23, 2020 8:24 am

bogs wrote:
Wed Apr 22, 2020 11:00 pm
First, your links -
Thank you for making my sudo-urls into proper urls. Much appreciated.
bogs wrote:
Wed Apr 22, 2020 11:00 pm
Second - I didn't notice any use of 'lock screen' or 'lockscreen'. If your moving stuff around, probably a good idea to stop the screen painting from happening.
The use of lockscreen does help to speed things up normally (say, for example if I had a script that makes a load of buttons and arranges them in a grid). I'd lock screen while the script creates and arranges the buttons, then unlock screen when done).

However, I'd not used lock screen and unlock screen on purpose in this example as I wanted the animation to be visible. Locking and unlocking the screen with this (every 1 tick) would actually add a negative performance impact.

But I do take what you say onboard, and am not trying to be dismissive. I've used lock screen to great effect in the past to speed up creating graphics on cards, but not exactly what is needed here as I'm only moving by 1px using the send command in ticks.

Many thanks.

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Performance when multitasking

Post by bogs » Thu Apr 23, 2020 9:53 am

Ah HAH! I had 2 brain cells fire, and remembered the thread I was thinking of !! viewtopic.php?f=22&t=30049&hilit=animation

That is the absolute beginning of the thread, it doesn't start to get real interesting until here, though.

Jim L.'s stack was an interesting take on it as well, but kind of buggy (JOKE!!), and it was his behavior based animation I was actually thinking of when I posted above.

Based on what you wrote in the last few posts here, I am (pretty) sure you've been around this language longer than I, but I suspect that you will find LS to figure into what your doing, possibly not as written, but as it will be written later.

I am no expert on the topic, as I mention in the thread linked above, but from all I've seen, LS works out like double buffering or paging in most languages I did spend more time in, and at this point I can't imagine animation without that type of help going on.

Good luck with whatever your working on :D
Image

AndyP
Posts: 634
Joined: Wed Aug 27, 2008 12:57 pm
Contact:

Re: Performance when multitasking

Post by AndyP » Thu Apr 23, 2020 1:10 pm

Just to confuse matters ... sorry!

I'm running native Win 10 and have run your stack in Win 10 native, Linux Mint and Mac in virtual Box.

I've added a screenshot below to show the results I'm seeing.

I think you need helpers to try on each platform native to get some type of definitive answer as I believe the VM may be confusing the issue.

Happy hunting :)
Attachments
MT-All.png
Andy .... LC CLASSIC ROCKS!

tperry2x
Posts: 23
Joined: Wed Apr 22, 2020 9:58 pm

Re: Performance when multitasking

Post by tperry2x » Thu Apr 23, 2020 4:32 pm

Not confusing matters at all.
It's interesting, as for you - Windows 10 has the highest performance decrease, and Linux and MacOS show no performance hit.
Hmmmmm... okay, perhaps I'll try a different version of MacOS that isn't a VM.
What version of Mac OS / OSX did you test it on?

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

Re: Performance when multitasking

Post by jacque » Thu Apr 23, 2020 4:37 pm

I haven't looked at the stack (so I'm not qualified to answer) but did you set the layermode of the moving objects to "dynamic"? This is necessary when using acceleratedRendering.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

tperry2x
Posts: 23
Joined: Wed Apr 22, 2020 9:58 pm

Re: Performance when multitasking

Post by tperry2x » Thu Apr 23, 2020 4:38 pm

Hmmm, no I haven't tried setting the layer mode to anything different.
But, layer mode isn't set to anything in Linux or Windows and they behave so differently.
I just tried a build on an old mac, running Mac OS 10 7 and it was smooth with hardly any slowdown.

Ugh, only a few more posts before I can post images to show what I mean.

tperry2x
Posts: 23
Joined: Wed Apr 22, 2020 9:58 pm

Re: Performance when multitasking

Post by tperry2x » Thu Apr 23, 2020 4:47 pm

I've just tried setting the layer mode to dynamic.
Unfortunately it's made no difference. Hmmm :( I'll do some more testing.

Thanks for the suggestion though.

tperry2x
Posts: 23
Joined: Wed Apr 22, 2020 9:58 pm

Re: Performance when multitasking

Post by tperry2x » Thu Apr 23, 2020 8:10 pm

So, tested on OSX 10.7
Image
(forgot to turn on the box for accelerated rendering under OSX 10.7, but meh - performance not too bad anyway).

and on OSX 10.11
Image
(nearly maxed out. Frame rate is a 4th of what is should be - very choppy).

Neither of these are VMs, so I'm guessing the problem is with OSX 10.11 possibly.

Thought I'd try with a higher version of OSX 10.14
(I have the luxury of being an IT technician, so have lots of machines to test on at the moment).

I'll see how that goes. If that shows no slowdown, I then either know it's a problem with my machine or a problem related to OS X 10.11 itself.
These tests will be with a vanilla, generic, fresh clean 10.11 and 10.14 install...

tperry2x
Posts: 23
Joined: Wed Apr 22, 2020 9:58 pm

Re: Performance when multitasking

Post by tperry2x » Thu Apr 23, 2020 8:41 pm

Image
And next to no slowdown under OSX 10.14.

So, question is, what is wrong with:
A: My OSX 10.11
B: All OSX 10.11

Long shot, but if someone else is on OSX 10.11 and can do a test, that would be great. Until then, I'll see if I can beg / borrow the use of someone's mac who likes to run an older OS (like me).

Post Reply