Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

We can predict everything, except the future.


devel / comp.lang.c / Re: "C Is The Greenest Programming Language" by: Chris Lott

SubjectAuthor
* "C Is The Greenest Programming Language" by: Chris LottLynn McGuire
+* Re: "C Is The Greenest Programming Language" by: Chris LottChris M. Thomasson
|`* Re: "C Is The Greenest Programming Language" by: Chris LottJuha Nieminen
| +* Re: "C Is The Greenest Programming Language" by: Chris LottChris M. Thomasson
| |`* Re: "C Is The Greenest Programming Language" by: Chris LottJuha Nieminen
| | `* Re: "C Is The Greenest Programming Language" by: Chris LottPhilipp Klaus Krause
| |  `- Re: "C Is The Greenest Programming Language" by: Chris LottDavid Brown
| `- Re: "C Is The Greenest Programming Language" by: Chris LottChris M. Thomasson
+* Re: "C Is The Greenest Programming Language" by: Chris LottRichard Damon
|+* Re: "C Is The Greenest Programming Language" by: Chris LottJuha Nieminen
||+- Re: "C Is The Greenest Programming Language" by: Chris LottThiago Adams
||+* Re: "C Is The Greenest Programming Language" by: Chris LottGuillaume
|||`- Re: "C Is The Greenest Programming Language" by: Chris LottJuha Nieminen
||`* Re: "C Is The Greenest Programming Language" by: Chris LottLynn McGuire
|| `- Re: "C Is The Greenest Programming Language" by: Chris LottScott Lurndal
|`- Re: "C Is The Greenest Programming Language" by: Chris LottPhilipp Klaus Krause
+* Re: "C Is The Greenest Programming Language" by: Chris LottOtto J. Makela
|+* Re: "C Is The Greenest Programming Language" by: Chris LottDozingDog
||`* Re: "C Is The Greenest Programming Language" by: Chris LottOtto J. Makela
|| `- Re: "C Is The Greenest Programming Language" by: Chris LottDozingDog
|`* Re: "C Is The Greenest Programming Language" by: Chris LottLynn McGuire
| `* Re: "C Is The Greenest Programming Language" by: Chris LottOtto J. Makela
|  `- Re: "C Is The Greenest Programming Language" by: Chris LottLynn McGuire
+* Re: "C Is The Greenest Programming Language" by: Chris LottBonita Montero
|`* Re: "C Is The Greenest Programming Language" by: Chris LottDozingDog
| `* Re: "C Is The Greenest Programming Language" by: Chris LottRichard Damon
|  +* Re: "C Is The Greenest Programming Language" by: Chris LottBonita Montero
|  |+* Re: "C Is The Greenest Programming Language" by: Chris LottRichard Damon
|  ||`* Re: "C Is The Greenest Programming Language" by: Chris LottBonita Montero
|  || +- Re: "C Is The Greenest Programming Language" by: Chris LottMalcolm McLean
|  || `* Re: "C Is The Greenest Programming Language" by: Chris LottRichard Damon
|  ||  `* Re: "C Is The Greenest Programming Language" by: Chris LottBonita Montero
|  ||   `* Re: "C Is The Greenest Programming Language" by: Chris LottRichard Damon
|  ||    `* Re: "C Is The Greenest Programming Language" by: Chris LottBonita Montero
|  ||     `* Re: "C Is The Greenest Programming Language" by: Chris LottRichard Damon
|  ||      `- Re: "C Is The Greenest Programming Language" by: Chris LottBonita Montero
|  |`- Re: "C Is The Greenest Programming Language" by: Chris LottMalcolm McLean
|  `* Re: "C Is The Greenest Programming Language" by: Chris LottDozingDog
|   `* Re: "C Is The Greenest Programming Language" by: Chris LottRichard Damon
|    `* Re: "C Is The Greenest Programming Language" by: Chris LottDozingDog
|     +* Re: "C Is The Greenest Programming Language" by: Chris LottJuha Nieminen
|     |`- Re: "C Is The Greenest Programming Language" by: Chris LottDozingDog
|     `* Re: "C Is The Greenest Programming Language" by: Chris LottRichard Damon
|      +- Re: "C Is The Greenest Programming Language" by: Chris LottDozingDog
|      `- Re: "C Is The Greenest Programming Language" by: Chris LottThiago Adams
+* Re: "C Is The Greenest Programming Language" by: Chris LottManfred
|+* Re: "C Is The Greenest Programming Language" by: Chris LottKenny McCormack
||+* Re: "C Is The Greenest Programming Language" by: Chris LottDavid Brown
|||+* Re: "C Is The Greenest Programming Language" by: Chris LottDozingDog
||||+- Re: "C Is The Greenest Programming Language" by: Chris LottRichard Damon
||||`* Re: "C Is The Greenest Programming Language" by: Chris LottDavid Brown
|||| `* Re: "C Is The Greenest Programming Language" by: Chris LottRichard Damon
||||  `- Re: "C Is The Greenest Programming Language" by: Chris LottDavid Brown
|||`* Re: "C Is The Greenest Programming Language" by: Chris LottManfred
||| +* Re: "C Is The Greenest Programming Language" by: Chris LottBart
||| |+* Re: "C Is The Greenest Programming Language" by: Chris LottIan Collins
||| ||`- Re: "C Is The Greenest Programming Language" by: Chris LottBart
||| |+* Re: "C Is The Greenest Programming Language" by: Chris LottDavid Brown
||| ||`* Re: "C Is The Greenest Programming Language" by: Chris LottBart
||| || `* Re: "C Is The Greenest Programming Language" by: Chris Lottantispam
||| ||  `- Re: "C Is The Greenest Programming Language" by: Chris LottBart
||| |`- Re: "C Is The Greenest Programming Language" by: Chris LottManfred
||| `* Re: "C Is The Greenest Programming Language" by: Chris LottDavid Brown
|||  `* Re: "C Is The Greenest Programming Language" by: Chris LottManfred
|||   `- Re: "C Is The Greenest Programming Language" by: Chris LottBart
||`- Re: "C Is The Greenest Programming Language" by: Chris LottManfred
|+- Re: "C Is The Greenest Programming Language" by: Chris LottBart
|`* Re: "C Is The Greenest Programming Language" by: Chris LottPhilipp Klaus Krause
| +* Re: "C Is The Greenest Programming Language" by: Chris LottKeith Thompson
| |+* Re: "C Is The Greenest Programming Language" by: Chris LottDavid Brown
| ||`- Re: "C Is The Greenest Programming Language" by: Chris LottPhilipp Klaus Krause
| |`- Re: "C Is The Greenest Programming Language" by: Chris LottPhilipp Klaus Krause
| `* Re: "C Is The Greenest Programming Language" by: Chris LottPhilipp Klaus Krause
|  `* Re: "C Is The Greenest Programming Language" by: Chris LottBart
|   +- Re: "C Is The Greenest Programming Language" by: Chris LottPhilipp Klaus Krause
|   `* Re: "C Is The Greenest Programming Language" by: Chris Lottantispam
|    `* Re: "C Is The Greenest Programming Language" by: Chris LottBart
|     `* [OT] Lisp. Was: "C Is The Greenest Programming Language" by: Chris LottBen Bacarisse
|      `* Re: "C Is The Greenest Programming Language"Dave Dunfield
|       `* Re: "C Is The Greenest Programming Language"Ben Bacarisse
|        `* Re: "C Is The Greenest Programming Language"Dave Dunfield
|         `* Re: "C Is The Greenest Programming Language"Ben Bacarisse
|          `* Re: "C Is The Greenest Programming Language"Dave Dunfield
|           `- Re: "C Is The Greenest Programming Language"Ben Bacarisse
+* Re: "C Is The Greenest Programming Language" by: Chris LottChris M. Thomasson
|`- Re: "C Is The Greenest Programming Language" by: Chris LottManfred
`* Re: "C Is The Greenest Programming Language" by: Chris LottPaavo Helde
 +* Re: "C Is The Greenest Programming Language" by: Chris LottChris M. Thomasson
 |`* Re: "C Is The Greenest Programming Language" by: Chris LottMalcolm McLean
 | `* Re: "C Is The Greenest Programming Language" by: Chris LottChris M. Thomasson
 |  `- Re: "C Is The Greenest Programming Language" by: Chris LottChris M. Thomasson
 +* Re: "C Is The Greenest Programming Language" by: Chris LottManfred
 |`- Re: "C Is The Greenest Programming Language" by: Chris LottPaavo Helde
 `- Re: "C Is The Greenest Programming Language" by: Chris LottBonita Montero

Pages:1234
"C Is The Greenest Programming Language" by: Chris Lott

<snh51g$c1q$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19146&group=comp.lang.c#19146

  copy link   Newsgroups: comp.lang.c comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: lynnmcgu...@gmail.com (Lynn McGuire)
Newsgroups: comp.lang.c,comp.lang.c++
Subject: "C Is The Greenest Programming Language" by: Chris Lott
Date: Mon, 22 Nov 2021 16:19:27 -0600
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <snh51g$c1q$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 22 Nov 2021 22:19:28 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="e874a5d66a817c47942c77400b7fffbe";
logging-data="12346"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+/i0ndizB1HZkaI/ecvAbR"
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.3.1
Cancel-Lock: sha1:bzPQQ7g8nbvBP1h9nVU8yaAJM5w=
Content-Language: en-US
 by: Lynn McGuire - Mon, 22 Nov 2021 22:19 UTC

"C Is The Greenest Programming Language" by: Chris Lott
https://hackaday.com/2021/11/18/c-is-the-greenest-programming-language/

"Have you ever wondered if there is a correlation between a computer’s
energy consumption and the choice of programming languages? Well, a
group Portuguese university researchers did and set out to quantify it.
Their 2017 research paper entitled Energy Efficiency across Programming
Languages / How Do Energy, Time, and Memory Relate? may have escaped
your attention, as it did ours."
https://greenlab.di.uminho.pt/wp-content/uploads/2017/10/sleFinal.pdf

"Abstract: This paper presents a study of the runtime, memory usage and
energy consumption of twenty seven well-known soft- ware languages. We
monitor the performance of such lan- guages using ten different
programming problems, expressed in each of the languages. Our results
show interesting find- ings, such as, slower/faster languages consuming
less/more energy, and how memory usage influences energy consump- tion.
We show how to use our results to provide software engineers support to
decide which language to use when energy efficiency is a concern."

Lynn

Re: "C Is The Greenest Programming Language" by: Chris Lott

<snh7bj$qjj$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19147&group=comp.lang.c#19147

  copy link   Newsgroups: comp.lang.c comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c,comp.lang.c++
Subject: Re: "C Is The Greenest Programming Language" by: Chris Lott
Date: Mon, 22 Nov 2021 14:58:59 -0800
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <snh7bj$qjj$1@dont-email.me>
References: <snh51g$c1q$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 22 Nov 2021 22:58:59 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="0cf9cc2254f62378665650fa6e62a23e";
logging-data="27251"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+SY5CPqwbFgDGXRADRFFfZT52HiTeRPoE="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.3.2
Cancel-Lock: sha1:/FuQR+SZv0WOVTQ0dcjqzySSN9g=
In-Reply-To: <snh51g$c1q$1@dont-email.me>
Content-Language: en-US
 by: Chris M. Thomasson - Mon, 22 Nov 2021 22:58 UTC

On 11/22/2021 2:19 PM, Lynn McGuire wrote:
> "C Is The Greenest Programming Language" by: Chris Lott
>    https://hackaday.com/2021/11/18/c-is-the-greenest-programming-language/
>
> "Have you ever wondered if there is a correlation between a computer’s
> energy consumption and the choice of programming languages? Well, a
> group Portuguese university researchers did and set out to quantify it.
> Their 2017 research paper entitled Energy Efficiency across Programming
> Languages / How Do Energy, Time, and Memory Relate?  may have escaped
> your attention, as it did ours."
>    https://greenlab.di.uminho.pt/wp-content/uploads/2017/10/sleFinal.pdf
>
> "Abstract: This paper presents a study of the runtime, memory usage and
> energy consumption of twenty seven well-known soft- ware languages. We
> monitor the performance of such lan- guages using ten different
> programming problems, expressed in each of the languages. Our results
> show interesting find- ings, such as, slower/faster languages consuming
> less/more energy, and how memory usage influences energy consump- tion.
> We show how to use our results to provide software engineers support to
> decide which language to use when energy efficiency is a concern."

Interesting. However, I can write something in C that uses all CPU's
100%. So, green okay... What is it doing, is another matter, so to speak?

Re: "C Is The Greenest Programming Language" by: Chris Lott

<hGVmJ.45875$Gco3.43326@fx01.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19148&group=comp.lang.c#19148

  copy link   Newsgroups: comp.lang.c comp.lang.c++
Path: i2pn2.org!i2pn.org!paganini.bofh.team!news.dns-netz.com!news.freedyn.net!newsreader4.netcologne.de!news.netcologne.de!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx01.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0)
Gecko/20100101 Thunderbird/91.3.2
Subject: Re: "C Is The Greenest Programming Language" by: Chris Lott
Content-Language: en-US
Newsgroups: comp.lang.c,comp.lang.c++
References: <snh51g$c1q$1@dont-email.me>
From: Rich...@Damon-Family.org (Richard Damon)
In-Reply-To: <snh51g$c1q$1@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 34
Message-ID: <hGVmJ.45875$Gco3.43326@fx01.iad>
X-Complaints-To: abuse@easynews.com
Organization: Forte - www.forteinc.com
X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise we will be unable to process your complaint properly.
Date: Mon, 22 Nov 2021 18:25:58 -0500
X-Received-Bytes: 2735
 by: Richard Damon - Mon, 22 Nov 2021 23:25 UTC

On 11/22/21 5:19 PM, Lynn McGuire wrote:
> "C Is The Greenest Programming Language" by: Chris Lott
>    https://hackaday.com/2021/11/18/c-is-the-greenest-programming-language/
>
> "Have you ever wondered if there is a correlation between a computer’s
> energy consumption and the choice of programming languages? Well, a
> group Portuguese university researchers did and set out to quantify it.
> Their 2017 research paper entitled Energy Efficiency across Programming
> Languages / How Do Energy, Time, and Memory Relate?  may have escaped
> your attention, as it did ours."
>    https://greenlab.di.uminho.pt/wp-content/uploads/2017/10/sleFinal.pdf
>
> "Abstract: This paper presents a study of the runtime, memory usage and
> energy consumption of twenty seven well-known soft- ware languages. We
> monitor the performance of such lan- guages using ten different
> programming problems, expressed in each of the languages. Our results
> show interesting find- ings, such as, slower/faster languages consuming
> less/more energy, and how memory usage influences energy consump- tion.
> We show how to use our results to provide software engineers support to
> decide which language to use when energy efficiency is a concern."
>
> Lynn

Well since one of the goals of the C Language was to enable programmers
to write fast code, it can makes sense for C to be 'Green', at least by
some measures.

Fast code will be more energy efficient as processors basically use
power based on the number of instructions executed (and memory accessed).

What also needs to be considered is the time/energy needed to initially
WRITE the code and get it working, and then factor in how many times the
program will be used compared to the effort to write it.

Re: "C Is The Greenest Programming Language" by: Chris Lott

<sni44d$1l1s$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19156&group=comp.lang.c#19156

  copy link   Newsgroups: comp.lang.c comp.lang.c++
Path: i2pn2.org!i2pn.org!aioe.org!NK0c7qMEn6mmBWqphs27pg.user.46.165.242.75.POSTED!not-for-mail
From: nos...@thanks.invalid (Juha Nieminen)
Newsgroups: comp.lang.c,comp.lang.c++
Subject: Re: "C Is The Greenest Programming Language" by: Chris Lott
Date: Tue, 23 Nov 2021 07:10:07 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <sni44d$1l1s$1@gioia.aioe.org>
References: <snh51g$c1q$1@dont-email.me> <snh7bj$qjj$1@dont-email.me>
Injection-Info: gioia.aioe.org; logging-data="54332"; posting-host="NK0c7qMEn6mmBWqphs27pg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: tin/2.4.3-20181224 ("Glen Mhor") (UNIX) (Linux/5.4.42-grsec-kapsi (x86_64))
X-Notice: Filtered by postfilter v. 0.9.2
 by: Juha Nieminen - Tue, 23 Nov 2021 07:10 UTC

In comp.lang.c++ Chris M. Thomasson <chris.m.thomasson.1@gmail.com> wrote:
> Interesting. However, I can write something in C that uses all CPU's
> 100%.

I don't think that's the point.

Re: "C Is The Greenest Programming Language" by: Chris Lott

<sni4pq$1v37$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19157&group=comp.lang.c#19157

  copy link   Newsgroups: comp.lang.c comp.lang.c++
Path: i2pn2.org!i2pn.org!aioe.org!NK0c7qMEn6mmBWqphs27pg.user.46.165.242.75.POSTED!not-for-mail
From: nos...@thanks.invalid (Juha Nieminen)
Newsgroups: comp.lang.c,comp.lang.c++
Subject: Re: "C Is The Greenest Programming Language" by: Chris Lott
Date: Tue, 23 Nov 2021 07:21:32 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <sni4pq$1v37$1@gioia.aioe.org>
References: <snh51g$c1q$1@dont-email.me> <hGVmJ.45875$Gco3.43326@fx01.iad>
Injection-Info: gioia.aioe.org; logging-data="64615"; posting-host="NK0c7qMEn6mmBWqphs27pg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: tin/2.4.3-20181224 ("Glen Mhor") (UNIX) (Linux/5.4.42-grsec-kapsi (x86_64))
X-Notice: Filtered by postfilter v. 0.9.2
 by: Juha Nieminen - Tue, 23 Nov 2021 07:21 UTC

In comp.lang.c++ Richard Damon <Richard@damon-family.org> wrote:
> Well since one of the goals of the C Language was to enable programmers
> to write fast code, it can makes sense for C to be 'Green', at least by
> some measures.
>
> Fast code will be more energy efficient as processors basically use
> power based on the number of instructions executed (and memory accessed).

I think that for as long as programmable computers have existed, there has
been a direct correlation between the "levelness" ("higher-level" vs.
"low-level") of a language and disregard towards how much resources the
language uses. As computers have become faster and faster, and the amount
of resources (primarily RAM) has increased, this indifference towards
resource consumption in higher-level languages has only likewise
increased.

The farther away the design of the language has been from the details of
the underlying hardware, the more the question of "how efficient is
the language, and how much RAM does it consume?" has been (implicitly
or explicitly) answered with, essentially, "it doesn't matter" and
"who cares?"

Take pretty much any scripting language, or any other interpreted
language (like the original BASIC and most of its subsequent variants).
Pretty much nobody cared how fast they are, or how much RAM they
consume. When someone is, let's say, implementing something in PHP
they seldom stop to think how much memory it consumes or how fast it is.
When someone is implementing something in shell script, one most
definitely does not think about speed or memory consumption.

Most object-oriented languages don't really care about, especially,
memory consumption. Especially garbage-collected OO languages don't
give a flying F about memory consumption. So what if an object needs
something like 16 or 32 bytes of bookeeping data? Who cares? That's
nothing! Trivial and inconsequential! Modern computers have gigabytes
of RAM! Why should you care if an object takes 32 bytes in addition
to whatever is inside it? What a silly notion!

Ironically, the programming world has in the last couple of decades awakened
to the harsh realization that this complete disregard of memory usage
actually causes inefficiencies in modern CPU architectures (because
cache misses are very expensive).

Oh well. As long as it works, who cares? Buy a faster computer.

Re: "C Is The Greenest Programming Language" by: Chris Lott

<87ilwjoykx.fsf@tigger.extechop.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19160&group=comp.lang.c#19160

  copy link   Newsgroups: comp.lang.c comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: om...@iki.fi (Otto J. Makela)
Newsgroups: comp.lang.c,comp.lang.c++
Subject: Re: "C Is The Greenest Programming Language" by: Chris Lott
Date: Tue, 23 Nov 2021 14:17:50 +0200
Organization: Games and Theory
Lines: 14
Message-ID: <87ilwjoykx.fsf@tigger.extechop.net>
References: <snh51g$c1q$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="b81b9745b1744b62df0bf3131c1fccbd";
logging-data="5790"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19FZHvCKZqZuOvIGOk7rJ7f"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:GIlUD+owPOYH+AWxoOzO1RLUKM4=
sha1:p4R8uuqwd8NQLXJzxEYckQqfcgs=
X-Face: 'g'S,X"!c;\pfvl4ljdcm?cDdk<-Z;`x5;YJPI-cs~D%;_<\V3!3GCims?a*;~u$<FYl@"E
c?3?_J+Zwn~{$8<iEy}EqIn_08"`oWuqO$#(5y3hGq8}BG#sag{BL)u8(c^Lu;*{8+'Z-k\?k09ILS
X-URL: http://www.iki.fi/om/
Mail-Copies-To: never
 by: Otto J. Makela - Tue, 23 Nov 2021 12:17 UTC

Lynn McGuire <lynnmcguire5@gmail.com> wrote:

> "C Is The Greenest Programming Language" by: Chris Lott
> https://hackaday.com/2021/11/18/c-is-the-greenest-programming-language/

Perhaps one contributing factor is that not so much development is any
longer done using C or C++, and the programs that are run (and still
being developed) were originally created in the era when CPU power was
much lower than these days, so code optimization was more important.
--
/* * * Otto J. Makela <om@iki.fi> * * * * * * * * * */
/* Phone: +358 40 765 5772, ICBM: N 60 10' E 24 55' */
/* Mail: Mechelininkatu 26 B 27, FI-00100 Helsinki */
/* * * Computers Rule 01001111 01001011 * * * * * * */

Re: "C Is The Greenest Programming Language" by: Chris Lott

<541614ef-443b-49b4-b5cb-72540d1fa9c1n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19161&group=comp.lang.c#19161

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:ac8:5b83:: with SMTP id a3mr6060763qta.62.1637671835422;
Tue, 23 Nov 2021 04:50:35 -0800 (PST)
X-Received: by 2002:ae9:dc84:: with SMTP id q126mr4646639qkf.128.1637671835227;
Tue, 23 Nov 2021 04:50:35 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Tue, 23 Nov 2021 04:50:35 -0800 (PST)
In-Reply-To: <sni4pq$1v37$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=189.6.249.78; posting-account=xFcAQAoAAAAoWlfpQ6Hz2n-MU9fthxbY
NNTP-Posting-Host: 189.6.249.78
References: <snh51g$c1q$1@dont-email.me> <hGVmJ.45875$Gco3.43326@fx01.iad> <sni4pq$1v37$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <541614ef-443b-49b4-b5cb-72540d1fa9c1n@googlegroups.com>
Subject: Re: "C Is The Greenest Programming Language" by: Chris Lott
From: thiago.a...@gmail.com (Thiago Adams)
Injection-Date: Tue, 23 Nov 2021 12:50:35 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 3
 by: Thiago Adams - Tue, 23 Nov 2021 12:50 UTC

On Tuesday, November 23, 2021 at 4:21:44 AM UTC-3, Juha Nieminen wrote:
....
> Oh well. As long as it works, who cares? Buy a faster computer.
Everything costs money, especially on cloud solutions.

Re: "C Is The Greenest Programming Language" by: Chris Lott

<sniqts$6ks$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19162&group=comp.lang.c#19162

  copy link   Newsgroups: comp.lang.c comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c,comp.lang.c++
Subject: Re: "C Is The Greenest Programming Language" by: Chris Lott
Date: Tue, 23 Nov 2021 14:39:08 +0100
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <sniqts$6ks$1@dont-email.me>
References: <snh51g$c1q$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 23 Nov 2021 13:39:08 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="818c08068a1d2bb805bc0e58fbd6e193";
logging-data="6812"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19gUqXJD4RMgJYHYCHj6EwcdQK4RFWZrDg="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.3.2
Cancel-Lock: sha1:FEhjpZ0hhVbcYOalzaVM2ME4MGM=
In-Reply-To: <snh51g$c1q$1@dont-email.me>
Content-Language: de-DE
 by: Bonita Montero - Tue, 23 Nov 2021 13:39 UTC

Am 22.11.2021 um 23:19 schrieb Lynn McGuire:
> "C Is The Greenest Programming Language" by: Chris Lott
>    https://hackaday.com/2021/11/18/c-is-the-greenest-programming-language/
>
> "Have you ever wondered if there is a correlation between a computer’s
> energy consumption and the choice of programming languages? Well, a
> group Portuguese university researchers did and set out to quantify it.
> Their 2017 research paper entitled Energy Efficiency across Programming
> Languages / How Do Energy, Time, and Memory Relate?  may have escaped
> your attention, as it did ours."
>    https://greenlab.di.uminho.pt/wp-content/uploads/2017/10/sleFinal.pdf
>
> "Abstract: This paper presents a study of the runtime, memory usage and
> energy consumption of twenty seven well-known soft- ware languages. We
> monitor the performance of such lan- guages using ten different
> programming problems, expressed in each of the languages. Our results
> show interesting find- ings, such as, slower/faster languages consuming
> less/more energy, and how memory usage influences energy consump- tion.
> We show how to use our results to provide software engineers support to
> decide which language to use when energy efficiency is a concern."

Developing in C is a magnitude more effort than in C++, and if you've
the right programming-style you get the same code speed like in C. And
sometimes you're even faster in C++ and in C you'd shoot yourself in
your head instead of implementing the complexity you can handle in C++
in minutes.

Re: "C Is The Greenest Programming Language" by: Chris Lott

<snivri$15p1$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19166&group=comp.lang.c#19166

  copy link   Newsgroups: comp.lang.c comp.lang.c++
Path: i2pn2.org!i2pn.org!aioe.org!Puiiztk9lHEEQC0y3uUjRA.user.46.165.242.75.POSTED!not-for-mail
From: non...@add.invalid (Manfred)
Newsgroups: comp.lang.c,comp.lang.c++
Subject: Re: "C Is The Greenest Programming Language" by: Chris Lott
Date: Tue, 23 Nov 2021 16:03:14 +0100
Organization: Aioe.org NNTP Server
Message-ID: <snivri$15p1$1@gioia.aioe.org>
References: <snh51g$c1q$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="38689"; posting-host="Puiiztk9lHEEQC0y3uUjRA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.3.2
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: Manfred - Tue, 23 Nov 2021 15:03 UTC

On 11/22/2021 11:19 PM, Lynn McGuire wrote:
> Our results show interesting find- ings, such as, slower/faster
> languages consuming less/more energy, and how memory usage influences
> energy consump- tion

I find the correlation slower/faster language respectively less/more
energy quite confusing. In fact I believe it is the opposite.

An interpreted language (á la Java :O) may require orders of magnitude
more CPU instructions than C to perform the same task. This makes the
former slower and more energy consuming than the latter.

Slower or faster /hardware/ is a totally different thing, of course.

Re: "C Is The Greenest Programming Language" by: Chris Lott

<snj2k7$vojf$1@news.xmission.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19167&group=comp.lang.c#19167

  copy link   Newsgroups: comp.lang.c comp.lang.c++
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gaze...@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.lang.c,comp.lang.c++
Subject: Re: "C Is The Greenest Programming Language" by: Chris Lott
Date: Tue, 23 Nov 2021 15:50:31 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <snj2k7$vojf$1@news.xmission.com>
References: <snh51g$c1q$1@dont-email.me> <snivri$15p1$1@gioia.aioe.org>
Injection-Date: Tue, 23 Nov 2021 15:50:31 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="1041007"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Tue, 23 Nov 2021 15:50 UTC

In article <snivri$15p1$1@gioia.aioe.org>, Manfred <noname@add.invalid> wrote:
>On 11/22/2021 11:19 PM, Lynn McGuire wrote:
>> Our results show interesting find- ings, such as, slower/faster
>> languages consuming less/more energy, and how memory usage influences
>> energy consump- tion
>
>I find the correlation slower/faster language respectively less/more
>energy quite confusing. In fact I believe it is the opposite.

Yes. I think this was misstated/sloppily-written in the original text.

It depends, of course, on what exactly you mean by a "slower" language.
It is true that if you run the CPU at a slower speed (and that would make
for a slower processing model), then you will use less energy.

--
https://en.wikipedia.org/wiki/Mansplaining

It describes comp.lang.c to a T!

Re: "C Is The Greenest Programming Language" by: Chris Lott

<snj41a$dt8$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19170&group=comp.lang.c#19170

  copy link   Newsgroups: comp.lang.c comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (Bart)
Newsgroups: comp.lang.c,comp.lang.c++
Subject: Re: "C Is The Greenest Programming Language" by: Chris Lott
Date: Tue, 23 Nov 2021 16:14:33 +0000
Organization: A noiseless patient Spider
Lines: 34
Message-ID: <snj41a$dt8$1@dont-email.me>
References: <snh51g$c1q$1@dont-email.me> <snivri$15p1$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 23 Nov 2021 16:14:34 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="fec6f72312eaf3ef3e3bdfb10170ca3d";
logging-data="14248"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18LZNlDcxUjM5Ysn+1BimEJJLh25DzNTDc="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.3.1
Cancel-Lock: sha1:TCXVqCNdVYb3vp6XHmOExTBsqb0=
In-Reply-To: <snivri$15p1$1@gioia.aioe.org>
 by: Bart - Tue, 23 Nov 2021 16:14 UTC

On 23/11/2021 15:03, Manfred wrote:
> On 11/22/2021 11:19 PM, Lynn McGuire wrote:
>> Our results show interesting find- ings, such as, slower/faster
>> languages consuming less/more energy, and how memory usage influences
>> energy consump- tion
>
> I find the correlation slower/faster language respectively less/more
> energy quite confusing. In fact I believe it is the opposite.
>
> An interpreted language (á la Java :O) may require orders of magnitude
> more CPU instructions than C to perform the same task.

Java is probably not a good example.

Properly interpreted code may need 1-2 magnitudes more instructions as
it has to perform the task indirectly (this is with dynamic typing).

But this is only relevant if the processor is executing 100% indirect
code versus 100$ direct code.

In practice it will be a mix, which if done properly makes means the
overheads of interpretation are not significant.

More significant is overall design: you can write slow, bloated,
inefficient programs in C too!

Also many interpreted languages are now JIT-accelerated, to close the gap.

This makes the
> former slower and more energy consuming than the latter.
>
> Slower or faster /hardware/ is a totally different thing, of course.

Re: "C Is The Greenest Programming Language" by: Chris Lott

<snj65u$tmi$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19172&group=comp.lang.c#19172

  copy link   Newsgroups: comp.lang.c comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c,comp.lang.c++
Subject: Re: "C Is The Greenest Programming Language" by: Chris Lott
Date: Tue, 23 Nov 2021 17:51:09 +0100
Organization: A noiseless patient Spider
Lines: 57
Message-ID: <snj65u$tmi$1@dont-email.me>
References: <snh51g$c1q$1@dont-email.me> <snivri$15p1$1@gioia.aioe.org>
<snj2k7$vojf$1@news.xmission.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 23 Nov 2021 16:51:10 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="5f6523a86db0364c1979f9a63024662f";
logging-data="30418"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX182Uamj29VLF/YtIpUURKN66pkth+Iebvo="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:VZs07XRuN4zVj4IZkcsB9MEaiK0=
In-Reply-To: <snj2k7$vojf$1@news.xmission.com>
Content-Language: en-GB
 by: David Brown - Tue, 23 Nov 2021 16:51 UTC

On 23/11/2021 16:50, Kenny McCormack wrote:
> In article <snivri$15p1$1@gioia.aioe.org>, Manfred <noname@add.invalid> wrote:
>> On 11/22/2021 11:19 PM, Lynn McGuire wrote:
>>> Our results show interesting find- ings, such as, slower/faster
>>> languages consuming less/more energy, and how memory usage influences
>>> energy consump- tion
>>
>> I find the correlation slower/faster language respectively less/more
>> energy quite confusing. In fact I believe it is the opposite.
>
> Yes. I think this was misstated/sloppily-written in the original text.
>
> It depends, of course, on what exactly you mean by a "slower" language.
> It is true that if you run the CPU at a slower speed (and that would make
> for a slower processing model), then you will use less energy.
>

It is /not/ true that running the CPU at a slower speed uses less energy
- at least, it is often not true. It is complicated.

There are many aspects that affect how much energy is taken for a given
calculation.

Regarding programming languages, it is fairly obvious that a compiled
language that takes fewer instructions to do a task using optimised
assembly is going to use less energy than a language that has less
optimisation and more assembly instructions, or does some kind of
interpretation. Thus C (and other optimised compiled languages like
C++, Rust or Ada) are going to come out top.

It is less obvious how the details matter. Optimisation flags have an
effect, as do choices of instruction (as functional blocks such as SIMD
units or floating point units) may be dynamically enabled. For some
target processors, unrolling a loop to avoid branches will reduce energy
consumption - on others, rolled loops to avoid cache misses will be
better. Some compilers targeting embedded systems (where power usage is
often more important) have "optimise for power" as a third option to the
traditional "optimise for speed" and "optimise for size".

The power consumption for a processor is the sum of the static power and
the dynamic power. Dynamic power is proportional to the frequency and
the square of the voltage. And energy usage is power times time.

A processor that is designed to run at high frequency is likely to have
high-leakage transistors, and therefore high static power - when the
circuits are enabled. But the faster you get the work done, the higher
a proportion of the time you can have in low-power modes with minimal
static power. On the other hand, higher frequencies may need higher
voltages.

As a rule of thumb, it is better to run your cpu at its highest
frequency - or at the highest it can do without raising the voltage -
and get the calculation done fast. Then you can spend more time in
low-power sleep modes. However, entering and exiting sleep modes takes
time and energy, so you don't want to do it too often - hence the
"big-little" processor combinations where you have a slower core that
can be switched on and off more efficiently.

Re: "C Is The Greenest Programming Language" by: Chris Lott

<snj6ai$jkn$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19173&group=comp.lang.c#19173

  copy link   Newsgroups: comp.lang.c comp.lang.c++
Path: i2pn2.org!i2pn.org!aioe.org!BKzeqmo2UYxb4eR2zKm0zw.user.46.165.242.91.POSTED!not-for-mail
From: Dozing...@thekennel.co
Newsgroups: comp.lang.c,comp.lang.c++
Subject: Re: "C Is The Greenest Programming Language" by: Chris Lott
Date: Tue, 23 Nov 2021 16:53:38 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <snj6ai$jkn$1@gioia.aioe.org>
References: <snh51g$c1q$1@dont-email.me> <87ilwjoykx.fsf@tigger.extechop.net>
Injection-Info: gioia.aioe.org; logging-data="20119"; posting-host="BKzeqmo2UYxb4eR2zKm0zw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-Notice: Filtered by postfilter v. 0.9.2
 by: Dozing...@thekennel.co - Tue, 23 Nov 2021 16:53 UTC

On Tue, 23 Nov 2021 14:17:50 +0200
om@iki.fi (Otto J. Makela) wrote:
>Lynn McGuire <lynnmcguire5@gmail.com> wrote:
>
>> "C Is The Greenest Programming Language" by: Chris Lott
>> https://hackaday.com/2021/11/18/c-is-the-greenest-programming-language/
>
>Perhaps one contributing factor is that not so much development is any
>longer done using C or C++, and the programs that are run (and still
>being developed) were originally created in the era when CPU power was
>much lower than these days, so code optimization was more important.

Its good to see the attitude of just throw more CPU at something instead of
optimising it is still around. These days when server farms are taking up
a siginificant percentage of the planet's electrical output its beholder on
programmers to make their code as efficient as is reasonable.

Re: "C Is The Greenest Programming Language" by: Chris Lott

<snj6e1$l3e$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19174&group=comp.lang.c#19174

  copy link   Newsgroups: comp.lang.c comp.lang.c++
Path: i2pn2.org!i2pn.org!aioe.org!BKzeqmo2UYxb4eR2zKm0zw.user.46.165.242.91.POSTED!not-for-mail
From: Dozing...@thekennel.co
Newsgroups: comp.lang.c,comp.lang.c++
Subject: Re: "C Is The Greenest Programming Language" by: Chris Lott
Date: Tue, 23 Nov 2021 16:55:29 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <snj6e1$l3e$1@gioia.aioe.org>
References: <snh51g$c1q$1@dont-email.me> <sniqts$6ks$1@dont-email.me>
Injection-Info: gioia.aioe.org; logging-data="21614"; posting-host="BKzeqmo2UYxb4eR2zKm0zw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-Notice: Filtered by postfilter v. 0.9.2
 by: Dozing...@thekennel.co - Tue, 23 Nov 2021 16:55 UTC

On Tue, 23 Nov 2021 14:39:08 +0100
Bonita Montero <Bonita.Montero@gmail.com> wrote:
>Developing in C is a magnitude more effort than in C++, and if you've

That depends on the problem. If you're writing code that needs to store a
lot of structured data then C wouldn't be your first choice of language. But
if you're writing something that simply interfaces with system calls then
there's probably not much if any extra effort in using C over C++.

Re: "C Is The Greenest Programming Language" by: Chris Lott

<snj6h2$kf3$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19175&group=comp.lang.c#19175

  copy link   Newsgroups: comp.lang.c comp.lang.c++
Path: i2pn2.org!i2pn.org!aioe.org!5Eb5Kjev2xuaeX7DMmY97A.user.46.165.242.75.POSTED!not-for-mail
From: mess...@bottle.org (Guillaume)
Newsgroups: comp.lang.c,comp.lang.c++
Subject: Re: "C Is The Greenest Programming Language" by: Chris Lott
Date: Tue, 23 Nov 2021 17:56:56 +0100
Organization: Aioe.org NNTP Server
Message-ID: <snj6h2$kf3$1@gioia.aioe.org>
References: <snh51g$c1q$1@dont-email.me> <hGVmJ.45875$Gco3.43326@fx01.iad>
<sni4pq$1v37$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="20963"; posting-host="5Eb5Kjev2xuaeX7DMmY97A.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.3.2
Content-Language: fr
X-Notice: Filtered by postfilter v. 0.9.2
 by: Guillaume - Tue, 23 Nov 2021 16:56 UTC

Le 23/11/2021 à 08:21, Juha Nieminen a écrit :
> Oh well. As long as it works, who cares? Buy a faster computer.

This sentence shows that you quite obviously got what "green" means.

Re: "C Is The Greenest Programming Language" by: Chris Lott

<snj6mo$q04$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19176&group=comp.lang.c#19176

  copy link   Newsgroups: comp.lang.c comp.lang.c++
Path: i2pn2.org!rocksolid2!news.neodome.net!news.mixmin.net!aioe.org!BKzeqmo2UYxb4eR2zKm0zw.user.46.165.242.91.POSTED!not-for-mail
From: Dozing...@thekennel.co
Newsgroups: comp.lang.c,comp.lang.c++
Subject: Re: "C Is The Greenest Programming Language" by: Chris Lott
Date: Tue, 23 Nov 2021 17:00:08 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <snj6mo$q04$1@gioia.aioe.org>
References: <snh51g$c1q$1@dont-email.me> <snivri$15p1$1@gioia.aioe.org>
<snj2k7$vojf$1@news.xmission.com>
<snj65u$tmi$1@dont-email.me>
Injection-Info: gioia.aioe.org; logging-data="26628"; posting-host="BKzeqmo2UYxb4eR2zKm0zw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-Notice: Filtered by postfilter v. 0.9.2
 by: Dozing...@thekennel.co - Tue, 23 Nov 2021 17:00 UTC

On Tue, 23 Nov 2021 17:51:09 +0100
David Brown <david.brown@hesbynett.no> wrote:
>The power consumption for a processor is the sum of the static power and
>the dynamic power. Dynamic power is proportional to the frequency and
>the square of the voltage. And energy usage is power times time.
>
>A processor that is designed to run at high frequency is likely to have
>high-leakage transistors, and therefore high static power - when the
>circuits are enabled. But the faster you get the work done, the higher
>a proportion of the time you can have in low-power modes with minimal
>static power. On the other hand, higher frequencies may need higher
>voltages.
>
>As a rule of thumb, it is better to run your cpu at its highest
>frequency - or at the highest it can do without raising the voltage -
>and get the calculation done fast. Then you can spend more time in
>low-power sleep modes. However, entering and exiting sleep modes takes
>time and energy, so you don't want to do it too often - hence the
>"big-little" processor combinations where you have a slower core that
>can be switched on and off more efficiently.

Why do many battery powered systems throttle the CPU to save the battery when
its getting low then and why does undertaking CPU intensive tasks deplete the
battery faster? You seem to be claiming that you can get something for nothing.

Re: "C Is The Greenest Programming Language" by: Chris Lott

<Ww9nJ.30462$KV.13562@fx14.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19177&group=comp.lang.c#19177

  copy link   Newsgroups: comp.lang.c comp.lang.c++
Path: i2pn2.org!i2pn.org!news.swapon.de!news.uzoreto.com!npeer.as286.net!npeer-ng0.as286.net!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx14.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0)
Gecko/20100101 Thunderbird/91.3.2
Subject: Re: "C Is The Greenest Programming Language" by: Chris Lott
Content-Language: en-US
Newsgroups: comp.lang.c,comp.lang.c++
References: <snh51g$c1q$1@dont-email.me> <sniqts$6ks$1@dont-email.me>
<snj6e1$l3e$1@gioia.aioe.org>
From: Rich...@Damon-Family.org (Richard Damon)
In-Reply-To: <snj6e1$l3e$1@gioia.aioe.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 39
Message-ID: <Ww9nJ.30462$KV.13562@fx14.iad>
X-Complaints-To: abuse@easynews.com
Organization: Forte - www.forteinc.com
X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise we will be unable to process your complaint properly.
Date: Tue, 23 Nov 2021 12:28:12 -0500
X-Received-Bytes: 2846
 by: Richard Damon - Tue, 23 Nov 2021 17:28 UTC

On 11/23/21 11:55 AM, DozingDog@thekennel.co wrote:
> On Tue, 23 Nov 2021 14:39:08 +0100
> Bonita Montero <Bonita.Montero@gmail.com> wrote:
>> Developing in C is a magnitude more effort than in C++, and if you've
>
> That depends on the problem. If you're writing code that needs to store a
> lot of structured data then C wouldn't be your first choice of language. But
> if you're writing something that simply interfaces with system calls then
> there's probably not much if any extra effort in using C over C++.
>

I would disagree. With a decent compiler, C code can generate close to
assembly level optimizations for most problems. (Maybe it doesn't have
good support for defining Multiple Datapath Single Instruction
sequences, but a GOOD compiler maybe be able to detect and generate this).

ANYTHING in terms of data-structures that another language can generate,
you can generate in C.

The big disadvantage is that YOU as the programmer need to deal with a
lot of the issues rather than to compiler doing things for you, but that
is exactly why you can do things possibly more efficiently then the
compiler. You could have always generated the same algorithm that the
compiler did.

The one point where the compiler can do better is if there is a piece
like instruction sequencing to optimize performance, but that is where
the C language gives the implementation the freedom to adjust things to
allow for that.

The C language, with the common extensions, give you the power to do as
well as any other language.

Now, if you want to talk of the efficiency of WRITING the code, (as
opposed to executing it) all this power it gives you is a negative,
which seems to be what you are talking about.

If we want to talk 'Greenness', we need to define the development/usage
life cycle of the code.

Re: "C Is The Greenest Programming Language" by: Chris Lott

<%E9nJ.35067$cW6.16874@fx08.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19178&group=comp.lang.c#19178

  copy link   Newsgroups: comp.lang.c comp.lang.c++
Path: i2pn2.org!i2pn.org!aioe.org!feeder1.feed.usenet.farm!feed.usenet.farm!news-out.netnews.com!news.alt.net!fdc2.netnews.com!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx08.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0)
Gecko/20100101 Thunderbird/91.3.2
Subject: Re: "C Is The Greenest Programming Language" by: Chris Lott
Content-Language: en-US
Newsgroups: comp.lang.c,comp.lang.c++
References: <snh51g$c1q$1@dont-email.me> <snivri$15p1$1@gioia.aioe.org>
<snj2k7$vojf$1@news.xmission.com> <snj65u$tmi$1@dont-email.me>
<snj6mo$q04$1@gioia.aioe.org>
From: Rich...@Damon-Family.org (Richard Damon)
In-Reply-To: <snj6mo$q04$1@gioia.aioe.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 50
Message-ID: <%E9nJ.35067$cW6.16874@fx08.iad>
X-Complaints-To: abuse@easynews.com
Organization: Forte - www.forteinc.com
X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise we will be unable to process your complaint properly.
Date: Tue, 23 Nov 2021 12:36:48 -0500
X-Received-Bytes: 3674
 by: Richard Damon - Tue, 23 Nov 2021 17:36 UTC

On 11/23/21 12:00 PM, DozingDog@thekennel.co wrote:
> On Tue, 23 Nov 2021 17:51:09 +0100
> David Brown <david.brown@hesbynett.no> wrote:
>> The power consumption for a processor is the sum of the static power and
>> the dynamic power. Dynamic power is proportional to the frequency and
>> the square of the voltage. And energy usage is power times time.
>>
>> A processor that is designed to run at high frequency is likely to have
>> high-leakage transistors, and therefore high static power - when the
>> circuits are enabled. But the faster you get the work done, the higher
>> a proportion of the time you can have in low-power modes with minimal
>> static power. On the other hand, higher frequencies may need higher
>> voltages.
>>
>> As a rule of thumb, it is better to run your cpu at its highest
>> frequency - or at the highest it can do without raising the voltage -
>> and get the calculation done fast. Then you can spend more time in
>> low-power sleep modes. However, entering and exiting sleep modes takes
>> time and energy, so you don't want to do it too often - hence the
>> "big-little" processor combinations where you have a slower core that
>> can be switched on and off more efficiently.
>
> Why do many battery powered systems throttle the CPU to save the battery when
> its getting low then and why does undertaking CPU intensive tasks deplete the
> battery faster? You seem to be claiming that you can get something for nothing.
>

CPUs, at a given operating voltage will consume an approximately fixed
amount of energy per instruction.

One effect of slowing down the processor is that if it was running at
25% utilization, that means that 75% of the instructions executed did no
'useful' work, so slowing down the processor to make instructions take
longer means you do less of these wasteful cycles.

Some processors have the ability that when it get to those 'wasteful'
instructions it automatically 'stops' and drops its power concumption
until something happens that needs running again.

The other affect is that in many cases if you slow down the processor
speed, you can slightly drop the voltage you are running the processor
at, and the power consumed turns out to go largely as the square of the
voltage (as the dynamic power is consumed in charging and discharging
tiny capacitance through the system)

So, through various tricks in the system, you can sometimes save some
power when the processor is 'idle' or running 'slower'. Battery powered
system especially try to implement these sorts of capability.

Re: "C Is The Greenest Programming Language" by: Chris Lott

<snjagc$ut6$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19180&group=comp.lang.c#19180

  copy link   Newsgroups: comp.lang.c comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c,comp.lang.c++
Subject: Re: "C Is The Greenest Programming Language" by: Chris Lott
Date: Tue, 23 Nov 2021 19:05:01 +0100
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <snjagc$ut6$1@dont-email.me>
References: <snh51g$c1q$1@dont-email.me> <sniqts$6ks$1@dont-email.me>
<snj6e1$l3e$1@gioia.aioe.org> <Ww9nJ.30462$KV.13562@fx14.iad>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 23 Nov 2021 18:05:00 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="818c08068a1d2bb805bc0e58fbd6e193";
logging-data="31654"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19OlcHvLFhpM4scAht5Rxgxd07V2IBWxbU="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.3.2
Cancel-Lock: sha1:SygdT2Hix2oE4apxV8DEW6jlloI=
In-Reply-To: <Ww9nJ.30462$KV.13562@fx14.iad>
Content-Language: de-DE
 by: Bonita Montero - Tue, 23 Nov 2021 18:05 UTC

> ANYTHING in terms of data-structures that another language can generate,
> you can generate in C.

With a lot of effort compared to C++.

> The big disadvantage is that YOU as the programmer need to deal with a
> lot of the issues rather than to compiler doing things for you, but that
> is exactly why you can do things possibly more efficiently then the
> compiler. You could have always generated the same algorithm that the
> compiler did.

Why shoul one use sth. different than std::vector<>, std::string,
std::unordered_map<> ... ? There are no opportunities to make the
same more efficient.

Re: "C Is The Greenest Programming Language" by: Chris Lott

<snjbln$7rl$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19181&group=comp.lang.c#19181

  copy link   Newsgroups: comp.lang.c comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c,comp.lang.c++
Subject: Re: "C Is The Greenest Programming Language" by: Chris Lott
Date: Tue, 23 Nov 2021 19:24:55 +0100
Organization: A noiseless patient Spider
Lines: 36
Message-ID: <snjbln$7rl$1@dont-email.me>
References: <snh51g$c1q$1@dont-email.me> <snivri$15p1$1@gioia.aioe.org>
<snj2k7$vojf$1@news.xmission.com> <snj65u$tmi$1@dont-email.me>
<snj6mo$q04$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 23 Nov 2021 18:24:55 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="5f6523a86db0364c1979f9a63024662f";
logging-data="8053"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18ErPNT+1ZTIkOPClYn4zv3o5PQBNmPMio="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:AchqFTEbVVQyHFhWNIjzCMJKeMQ=
In-Reply-To: <snj6mo$q04$1@gioia.aioe.org>
Content-Language: en-GB
 by: David Brown - Tue, 23 Nov 2021 18:24 UTC

On 23/11/2021 18:00, DozingDog@thekennel.co wrote:
> On Tue, 23 Nov 2021 17:51:09 +0100
> David Brown <david.brown@hesbynett.no> wrote:
>> The power consumption for a processor is the sum of the static power and
>> the dynamic power. Dynamic power is proportional to the frequency and
>> the square of the voltage. And energy usage is power times time.
>>
>> A processor that is designed to run at high frequency is likely to have
>> high-leakage transistors, and therefore high static power - when the
>> circuits are enabled. But the faster you get the work done, the higher
>> a proportion of the time you can have in low-power modes with minimal
>> static power. On the other hand, higher frequencies may need higher
>> voltages.
>>
>> As a rule of thumb, it is better to run your cpu at its highest
>> frequency - or at the highest it can do without raising the voltage -
>> and get the calculation done fast. Then you can spend more time in
>> low-power sleep modes. However, entering and exiting sleep modes takes
>> time and energy, so you don't want to do it too often - hence the
>> "big-little" processor combinations where you have a slower core that
>> can be switched on and off more efficiently.
>
> Why do many battery powered systems throttle the CPU to save the battery when
> its getting low then and why does undertaking CPU intensive tasks deplete the
> battery faster? You seem to be claiming that you can get something for nothing.
>

If you have to do a certain calculation or set of calculations, it is
/usually/ more efficient to do them quickly and then let the processor
sleep deeper and longer.

Modern cpus generally do /not/ throttle the cpu speed to save battery
power. It only makes sense to slow down the processor if you have large
leakage currents that you can't turn off, in which case a slow clock can
mean lower energy overall. With modern devices, clock gating lets you
turn off all or parts of the core much more effectively.

Re: "C Is The Greenest Programming Language" by: Chris Lott

<0CanJ.130244$831.28837@fx40.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19182&group=comp.lang.c#19182

  copy link   Newsgroups: comp.lang.c comp.lang.c++
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx40.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0)
Gecko/20100101 Thunderbird/91.3.2
Subject: Re: "C Is The Greenest Programming Language" by: Chris Lott
Content-Language: en-US
Newsgroups: comp.lang.c,comp.lang.c++
References: <snh51g$c1q$1@dont-email.me> <sniqts$6ks$1@dont-email.me>
<snj6e1$l3e$1@gioia.aioe.org> <Ww9nJ.30462$KV.13562@fx14.iad>
<snjagc$ut6$1@dont-email.me>
From: Rich...@Damon-Family.org (Richard Damon)
In-Reply-To: <snjagc$ut6$1@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 44
Message-ID: <0CanJ.130244$831.28837@fx40.iad>
X-Complaints-To: abuse@easynews.com
Organization: Forte - www.forteinc.com
X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise we will be unable to process your complaint properly.
Date: Tue, 23 Nov 2021 13:41:54 -0500
X-Received-Bytes: 3072
 by: Richard Damon - Tue, 23 Nov 2021 18:41 UTC

On 11/23/21 1:05 PM, Bonita Montero wrote:
>> ANYTHING in terms of data-structures that another language can
>> generate, you can generate in C.
>
> With a lot of effort compared to C++.
>
>> The big disadvantage is that YOU as the programmer need to deal with a
>> lot of the issues rather than to compiler doing things for you, but
>> that is exactly why you can do things possibly more efficiently then
>> the compiler. You could have always generated the same algorithm that
>> the compiler did.
>
> Why shoul one use sth. different than std::vector<>, std::string,
> std::unordered_map<> ... ? There are no opportunities to make the
> same more efficient.
>

Except where there are.

For instance, I regularly use a variant of std:string that the char
const* constructor checks if the input is from 'read only' memory, and
if it is reuses that data instead of making a copy, at least until in
wants to change it. This saves me a LOT of memory in embedded systems
where most of my 'string' data is constant, but some spedific cases need
to dynamically compute the string.

The C++ standard library is very good code for the general case. There
can be cases where specific application requirements make alternative
better.

As I said, the fundamental issue is the trade off of final execution
efficiency for efficiency in writing the code.

C++ keeps a lot of the efficiencies of C, and adds some significant
'power' to the expresiveness. But sometimes implementing the C++
features directly in C while needing more coding by the programmer can
make some things more efficient.

For example, rather than letting the C++ class system implicitly handle
the 'vtable' for a class, there are tricks you can do to make some
operation more efficient in C with an explicit vtable (at the expense of
it adding all the explicit code). Things like changing the 'type' of a
structure to that of another compatible type with just a change of the
vtable pointer.

Re: "C Is The Greenest Programming Language" by: Chris Lott

<0KanJ.66939$VS2.55772@fx44.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19184&group=comp.lang.c#19184

  copy link   Newsgroups: comp.lang.c comp.lang.c++
Path: i2pn2.org!i2pn.org!aioe.org!feeder1.feed.usenet.farm!feed.usenet.farm!news-out.netnews.com!news.alt.net!fdc2.netnews.com!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx44.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0)
Gecko/20100101 Thunderbird/91.3.2
Subject: Re: "C Is The Greenest Programming Language" by: Chris Lott
Content-Language: en-US
Newsgroups: comp.lang.c,comp.lang.c++
References: <snh51g$c1q$1@dont-email.me> <snivri$15p1$1@gioia.aioe.org>
<snj2k7$vojf$1@news.xmission.com> <snj65u$tmi$1@dont-email.me>
<snj6mo$q04$1@gioia.aioe.org> <snjbln$7rl$1@dont-email.me>
From: Rich...@Damon-Family.org (Richard Damon)
In-Reply-To: <snjbln$7rl$1@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 58
Message-ID: <0KanJ.66939$VS2.55772@fx44.iad>
X-Complaints-To: abuse@easynews.com
Organization: Forte - www.forteinc.com
X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise we will be unable to process your complaint properly.
Date: Tue, 23 Nov 2021 13:50:25 -0500
X-Received-Bytes: 4233
 by: Richard Damon - Tue, 23 Nov 2021 18:50 UTC

On 11/23/21 1:24 PM, David Brown wrote:
> On 23/11/2021 18:00, DozingDog@thekennel.co wrote:
>> On Tue, 23 Nov 2021 17:51:09 +0100
>> David Brown <david.brown@hesbynett.no> wrote:
>>> The power consumption for a processor is the sum of the static power and
>>> the dynamic power. Dynamic power is proportional to the frequency and
>>> the square of the voltage. And energy usage is power times time.
>>>
>>> A processor that is designed to run at high frequency is likely to have
>>> high-leakage transistors, and therefore high static power - when the
>>> circuits are enabled. But the faster you get the work done, the higher
>>> a proportion of the time you can have in low-power modes with minimal
>>> static power. On the other hand, higher frequencies may need higher
>>> voltages.
>>>
>>> As a rule of thumb, it is better to run your cpu at its highest
>>> frequency - or at the highest it can do without raising the voltage -
>>> and get the calculation done fast. Then you can spend more time in
>>> low-power sleep modes. However, entering and exiting sleep modes takes
>>> time and energy, so you don't want to do it too often - hence the
>>> "big-little" processor combinations where you have a slower core that
>>> can be switched on and off more efficiently.
>>
>> Why do many battery powered systems throttle the CPU to save the battery when
>> its getting low then and why does undertaking CPU intensive tasks deplete the
>> battery faster? You seem to be claiming that you can get something for nothing.
>>
>
> If you have to do a certain calculation or set of calculations, it is
> /usually/ more efficient to do them quickly and then let the processor
> sleep deeper and longer.
>
> Modern cpus generally do /not/ throttle the cpu speed to save battery
> power. It only makes sense to slow down the processor if you have large
> leakage currents that you can't turn off, in which case a slow clock can
> mean lower energy overall. With modern devices, clock gating lets you
> turn off all or parts of the core much more effectively.
>

Not sure if this holds for desktop/laptop caliber processors, but in the
embedded world, many processors can have their core voltage dropped down
when running at slower speeds, and since switching energy is
proportional to V^2, slowing the processor and waiting less CAN save power.

I beleive this applies to processors with a 'Turbo' or 'Overclocked'
mode in the desktop/laptop space, to run their fastest, they need to
boost their power supplies at the cost of increase power consumption but
fast speeds become available.

Then there is the fact that the 'simple' idle modes don't stop
everything, so you are still burning the higher frequency power even
when idle in parts of the circuit, and switching to more power savings
mode can take a bit of time and actually cost power (as you power down
then back up sections of the die) means that slower, higher usage, uses
less power.

The problem is that this also limits you PEAK operational speed, so you
need to balence those needs with your power concumption.

Re: "C Is The Greenest Programming Language" by: Chris Lott

<snjdag$kpa$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19185&group=comp.lang.c#19185

  copy link   Newsgroups: comp.lang.c comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c,comp.lang.c++
Subject: Re: "C Is The Greenest Programming Language" by: Chris Lott
Date: Tue, 23 Nov 2021 19:53:04 +0100
Organization: A noiseless patient Spider
Lines: 9
Message-ID: <snjdag$kpa$1@dont-email.me>
References: <snh51g$c1q$1@dont-email.me> <sniqts$6ks$1@dont-email.me>
<snj6e1$l3e$1@gioia.aioe.org> <Ww9nJ.30462$KV.13562@fx14.iad>
<snjagc$ut6$1@dont-email.me> <0CanJ.130244$831.28837@fx40.iad>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 23 Nov 2021 18:53:04 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="818c08068a1d2bb805bc0e58fbd6e193";
logging-data="21290"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+mMGJakM6ou5aDFFSCNYtHMSW+yMCl2fk="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.3.2
Cancel-Lock: sha1:ufvUeOm+KeY8Of2HqLaIlfjH7cQ=
In-Reply-To: <0CanJ.130244$831.28837@fx40.iad>
Content-Language: de-DE
 by: Bonita Montero - Tue, 23 Nov 2021 18:53 UTC

Am 23.11.2021 um 19:41 schrieb Richard Damon:

> For instance, I regularly use a variant of std:string that the char
> const* constructor checks if the input is from 'read only' memory, and
> if it is reuses that data instead of making a copy, at least until in
> wants to change it. ...

Then use string_view.

Re: "C Is The Greenest Programming Language" by: Chris Lott

<snjds3$pdc$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19186&group=comp.lang.c#19186

  copy link   Newsgroups: comp.lang.c comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c,comp.lang.c++
Subject: Re: "C Is The Greenest Programming Language" by: Chris Lott
Date: Tue, 23 Nov 2021 20:02:27 +0100
Organization: A noiseless patient Spider
Lines: 79
Message-ID: <snjds3$pdc$1@dont-email.me>
References: <snh51g$c1q$1@dont-email.me> <snivri$15p1$1@gioia.aioe.org>
<snj2k7$vojf$1@news.xmission.com> <snj65u$tmi$1@dont-email.me>
<snj6mo$q04$1@gioia.aioe.org> <snjbln$7rl$1@dont-email.me>
<0KanJ.66939$VS2.55772@fx44.iad>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 23 Nov 2021 19:02:27 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="5f6523a86db0364c1979f9a63024662f";
logging-data="26028"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18AEsz9/+aT1uFrXHWf2V7D658pL8EMwhc="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:UL+p+1iqNCbBx+7klCz3UTzZ8xw=
In-Reply-To: <0KanJ.66939$VS2.55772@fx44.iad>
Content-Language: en-GB
 by: David Brown - Tue, 23 Nov 2021 19:02 UTC

On 23/11/2021 19:50, Richard Damon wrote:
> On 11/23/21 1:24 PM, David Brown wrote:
>> On 23/11/2021 18:00, DozingDog@thekennel.co wrote:
>>> On Tue, 23 Nov 2021 17:51:09 +0100
>>> David Brown <david.brown@hesbynett.no> wrote:
>>>> The power consumption for a processor is the sum of the static power
>>>> and
>>>> the dynamic power.  Dynamic power is proportional to the frequency and
>>>> the square of the voltage.  And energy usage is power times time.
>>>>
>>>> A processor that is designed to run at high frequency is likely to have
>>>> high-leakage transistors, and therefore high static power - when the
>>>> circuits are enabled.  But the faster you get the work done, the higher
>>>> a proportion of the time you can have in low-power modes with minimal
>>>> static power.  On the other hand, higher frequencies may need higher
>>>> voltages.
>>>>
>>>> As a rule of thumb, it is better to run your cpu at its highest
>>>> frequency - or at the highest it can do without raising the voltage -
>>>> and get the calculation done fast.  Then you can spend more time in
>>>> low-power sleep modes.  However, entering and exiting sleep modes takes
>>>> time and energy, so you don't want to do it too often - hence the
>>>> "big-little" processor combinations where you have a slower core that
>>>> can be switched on and off more efficiently.
>>>
>>> Why do many battery powered systems throttle the CPU to save the
>>> battery when
>>> its getting low then and why does undertaking CPU intensive tasks
>>> deplete the
>>> battery faster? You seem to be claiming that you can get something
>>> for nothing.
>>>
>>
>> If you have to do a certain calculation or set of calculations, it is
>> /usually/ more efficient to do them quickly and then let the processor
>> sleep deeper and longer.
>>
>> Modern cpus generally do /not/ throttle the cpu speed to save battery
>> power.  It only makes sense to slow down the processor if you have large
>> leakage currents that you can't turn off, in which case a slow clock can
>> mean lower energy overall.  With modern devices, clock gating lets you
>> turn off all or parts of the core much more effectively.
>>
>
> Not sure if this holds for desktop/laptop caliber processors, but in the
> embedded world, many processors can have their core voltage dropped down
> when running at slower speeds, and since switching energy is
> proportional to V^2, slowing the processor and waiting less CAN save power.

That depends on the class of embedded system. If you are talking about
large embedded processors - running embedded Linux, for instance - then
that's true. But even there you usually aim for high speed and lots of
sleep if you can. However, as I mentioned, entering and exiting sleep
modes takes some time - if you are doing it too frequently, that
overhead becomes dominant and it is better to run the whole thing at a
low clock rate.

Smaller embedded systems rarely change the voltage to the core.

>
> I beleive this applies to processors with a 'Turbo' or 'Overclocked'
> mode in the desktop/laptop space, to run their fastest, they need to
> boost their power supplies at the cost of increase power consumption but
> fast speeds become available.
>
> Then there is the fact that the 'simple' idle modes don't stop
> everything, so you are still burning the higher frequency power even
> when idle in parts of the circuit, and switching to more power savings
> mode can take a bit of time and actually cost power (as you power down
> then back up sections of the die) means that slower, higher usage, uses
> less power.
>
> The problem is that this also limits you PEAK operational speed, so you
> need to balence those needs with your power concumption.

It is all a complicated balance, and a subject of continuous development
and improvement - no one choice fits everything. (And the ideal power
management decisions need to know what a process is going to do before
it does it.)

Re: "C Is The Greenest Programming Language" by: Chris Lott

<snjfe0$12rk$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19187&group=comp.lang.c#19187

  copy link   Newsgroups: comp.lang.c comp.lang.c++
Path: i2pn2.org!i2pn.org!aioe.org!Puiiztk9lHEEQC0y3uUjRA.user.46.165.242.75.POSTED!not-for-mail
From: non...@add.invalid (Manfred)
Newsgroups: comp.lang.c,comp.lang.c++
Subject: Re: "C Is The Greenest Programming Language" by: Chris Lott
Date: Tue, 23 Nov 2021 20:29:04 +0100
Organization: Aioe.org NNTP Server
Message-ID: <snjfe0$12rk$1@gioia.aioe.org>
References: <snh51g$c1q$1@dont-email.me> <snivri$15p1$1@gioia.aioe.org>
<snj2k7$vojf$1@news.xmission.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="35700"; posting-host="Puiiztk9lHEEQC0y3uUjRA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.3.2
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: Manfred - Tue, 23 Nov 2021 19:29 UTC

On 11/23/2021 4:50 PM, Kenny McCormack wrote:
> In article <snivri$15p1$1@gioia.aioe.org>, Manfred <noname@add.invalid> wrote:
>> On 11/22/2021 11:19 PM, Lynn McGuire wrote:
>>> Our results show interesting find- ings, such as, slower/faster
>>> languages consuming less/more energy, and how memory usage influences
>>> energy consump- tion
>>
>> I find the correlation slower/faster language respectively less/more
>> energy quite confusing. In fact I believe it is the opposite.
>
> Yes. I think this was misstated/sloppily-written in the original text.
>
> It depends, of course, on what exactly you mean by a "slower" language.
> It is true that if you run the CPU at a slower speed (and that would make
> for a slower processing model), then you will use less energy.
>

Well, CPU speed is not a property of the language...

Pages:1234
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor