Page 1 of 1

Energi consumption difference

Posted: Sun Dec 05, 2010 1:57 pm
by oftit
Hi all

Does the computer use more energy by connecting to the internet and checking mails than doing delay()?
In code:

Code: Select all

Repeat
ConnectmailServer()
Check mails()
DisconnectMailServer()
ForEver

Vs.

Repeat
ConnectmailServer()
Check mails()
DisconnectMailServer()
Delay(10000)
ForEver
Which one consumes the most?

Thank you

Re: Energi consumption difference

Posted: Sun Dec 05, 2010 2:53 pm
by eesau
The first one uses more CPU cycles and thus more energy.

Re: Energi consumption difference

Posted: Sun Dec 05, 2010 3:11 pm
by oftit
Oh ok. Thank you.

Re: Energi consumption difference

Posted: Tue Dec 07, 2010 10:01 am
by Joakim Christiansen
eesau wrote:The first one uses more CPU cycles and thus more energy.
Not only that but it could cause a DoS on the mail server.

I would actually recommend running the code in a separate thread with a delay of one minute. Not that 10 seconds is bad, but when dealing with servers one should try to cause as little as possible traffic. If 1000 people were using a program to check the same mail server every 10 seconds that would be a total of 100 requests per second.