Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
simon.schvartzman
- Posts: 665
- Joined: Tue Jul 29, 2014 12:52 am
Post
by simon.schvartzman » Thu May 11, 2017 7:09 pm
I have developed a program that takes one picture per hour and sits idle the rest of the time.
Since I have severe power restrictions (the device is powered by solar panels) I wonder if there will be significant power drain differences between the 3 options below (or other alternatives I haven't figured out)
Option A
Code: Select all
send "mouseUp" to me in (3600) seconds
Option B
Option C
Code: Select all
put 3601 into Tempo
repeat while (Tempo > 0)
put Tempo - 1 into Tempo
end repeat
Needless to say I can perform some testings but I thought maybe somebody already knows the answer (BTW my guess is there will be no difference)
Regards...
-
dunbarx
- VIP Livecode Opensource Backer

- Posts: 10350
- Joined: Wed May 06, 2009 2:28 pm
Post
by dunbarx » Thu May 11, 2017 7:32 pm
I would think that the the third option takes more energy, simply because. But all three pale in comparison with the energy used just to keep the drives spinning. Don't talk to me about screensavers.
Craig Newman
-
simon.schvartzman
- Posts: 665
- Joined: Tue Jul 29, 2014 12:52 am
Post
by simon.schvartzman » Thu May 11, 2017 7:39 pm
@craig, thanks for your reply.
I wasn't clear enough in my original post. The App is actually running on an iPhone (no spinning drives...)
Simon
________________________________________
To ";" or not to ";" that is the question
-
dunbarx
- VIP Livecode Opensource Backer

- Posts: 10350
- Joined: Wed May 06, 2009 2:28 pm
Post
by dunbarx » Thu May 11, 2017 9:42 pm
Simon.
Ah.
But even so, the screen is the energy hog, and likely other apps running in the background. In other words, I don't know. But I bet it hardly matters except academically.
Craig
-
jacque
- VIP Livecode Opensource Backer

- Posts: 7393
- Joined: Sat Apr 08, 2006 8:31 pm
-
Contact:
Post
by jacque » Fri May 12, 2017 8:17 pm
Definitely use option A. The other two will lock up the CPU and either slow down or completely prevent any other activities (at least on desktop; I assume something similar could happen on mobile.) "Wait" and "repeat" do not yield any time for other processes to occur, they are completely blocking. Sending a message after a particular time interval allows the app to sleep/rest until the next event is due and is not blocking.
I can't think of any instances offhand where "send" is not preferable over "wait" or "repeat". You can add "with messages" to these commands to allow a sliver of time for the engine, but it still isn't as efficient as just sending the message at a later time.
http://www.hyperactivesw.com/polling.html
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
-
dunbarx
- VIP Livecode Opensource Backer

- Posts: 10350
- Joined: Wed May 06, 2009 2:28 pm
Post
by dunbarx » Sat May 13, 2017 12:47 am
What Jacque said. But she addressed an entirely different , though VERY important issue.
I have no idea how to measure the energy dissipated with any of your three options, as per to your original post, that is, energy. I wonder whether measuring the time it takes to go from 100% charge to 90% with all three of your methods might yield repeatable results. However judicious those methods might be in real life.
Craig