comp.lang.ada
 help / color / mirror / Atom feed
From: Fernando Oleo Blanco <irvise_ml@irvise.xyz>
Subject: Re: Comparing languages wrt energy, speed, and memory use
Date: Thu, 24 Feb 2022 10:13:46 +0100	[thread overview]
Message-ID: <20220224101346.1a70a96a@linux.fritz.box> (raw)
In-Reply-To: sv7cth$ob6$1@dont-email.me

Hi,

answer is interlaced with your text.

Am Thu, 24 Feb 2022 08:42:40 +0100
schrieb "G.B." <bauhaus@notmyhomepage.invalid>:

> One issue is Isaac Gouy's clever approach. (Not complaining. I
> sometimes didn't see the point, though, of adopting another new
> thing. For example, when a new regex library was introduced (at some
> point) that wins hands down by using optimization techniques you'd
> associate with JIT compilers or with data based optimization. Worth
> knowing about, but how does it help comparing languages when all you
> can do is link it to your program?)
> 

True, that is the case of GMP for some multiprecission test... Some
languages use it, other implement the algorithms themselves...

> 
> Can you be specific? For example, at least one program currently
> leads by making extensive use of x86 intrinsic ops.
> 
> Some use OMP with intrinsic 128bit ops. Does GNAT have a similar
> parallel loop in the language yet?
> 

Yes, take a look at
https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/nbody-gnat-2.html
it is taken from the Pascal implementation and uses intrinsics. My
point is that some of these programs are not very Ada-like. As far as I
remember, there was one ported from Lua.

Ada 2022 will have a parallel keyword. However, it is still not
supported in FSF GNAT, which is the one being used. Also, the
benchmarks are Ada 2012.

> 
> Yet, some Ada program versions #N+m used to run faster than #N. They
> now have their speed difference wiped out or even reversed...
> I see -march=ivybridge now, so the hardware has likely changed.
> 
> >     Some of the improvements that may have taken place in the
> >     language/compiler/tools may not be taken advantage of. For
> > example, the Ada examples are compiled with -gnatNp. Can anybody
> > say what that flag does? x)
> 
> GNAT User's Guide explains. (su-p-press and front end i-N-lining)
> 

Correct, but that switch has been deprecated for years, it is no longer
documented anywhere in the new GNAT releases:
https://gcc.gnu.org/onlinedocs/gcc-11.2.0/gnat_ugn.pdf

> > 3. C/C++/Rust program are competing on getting the best results.
> > Other languages are lagging behind. For example, Fortran could do
> > much better.
> 
> How would Fortran do much better? Can Ada learn from that?
> 

Fortran is using Intel's compiler, which is known to be one of the best.
Fortran compilers can much more easily generate SIMD code and
parallelise loops automatically if the code is idiomatic.

Also, Fortran was not fourth in the race a while ago. For example Ada
overtook Fortran for a small while. December 2018:
https://web.archive.org/web/20181204085050/https://benchmarksgame-team.pages.debian.net/benchmarksgame/which-programs-are-fast.html
Ada is fourth; while it was fifth in April of that same year
https://web.archive.org/web/20180406194535/https://benchmarksgame-team.pages.debian.net/benchmarksgame/which-programs-are-fastest.html
A year later, December 2019, Fortran could be fourth it it were not for
that outlier
https://web.archive.org/web/20191225172425/https://benchmarksgame-team.pages.debian.net/benchmarksgame/which-programs-are-fastest.html

These are the current results:
https://benchmarksgame-team.pages.debian.net/benchmarksgame/box-plot-summary-charts.html
Take a look at the evolution of the language podium. It has always been
C/C++/Rust, but starting from the fourth position there has been quite
a bit or rivalry.

> > 4. There are a few controversies. Some languages are not allowed to
> > use higher performance libraries while others are allowed their stl
> > or equivalent that do actually use the same tools as those
> > libraries. Thre are a few other examples.
> 
> Controversies add to the management's keeping this a lively benchmark.
> 
> > Ada has
> > been left behind since very few or nobody is actually taking a look
> > at the code and optimising it...
> 
> Care to be specific how it is not optimized? There is always room for
> better algorithms. Looking at fasta, the leading programs all use
> threading now, with the exception of the one at the top, which has an
> introductory comment.
> 

Some Ada programs could use better algorithms, data structures, more
up-to-date syntax and parallelism. Some programs could also be made a
bit prettier.


The crux of the issue is that you can pretty much always get peak
performance for non-GC languages if you use the same techniques,
libraries, algos, state of the art compilers, etc. And in a lot of real
world cases, even GC languages are not an issue, see Go, Erlang, Julia,
Lisp (SBCL), Nim...

But as someone (I believe it was the dean of TUM (Technische Universität
München)) once said: "Everybody knows that rankings are flawed, but it
is always better to be on top." The benchmark game, is after all, a
game. But some people took it to seriously. It is just like Football
hooligans.


Regards,
Fer

  reply	other threads:[~2022-02-24  9:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-20 22:59 Comparing languages wrt energy, speed, and memory use Jerry
2022-02-22 20:10 ` Fernando Oleo Blanco
2022-02-22 20:49   ` J-P. Rosen
2022-02-24  7:42   ` G.B.
2022-02-24  9:13     ` Fernando Oleo Blanco [this message]
2022-02-27  3:31 ` 25.BX943
2022-02-27  8:05 ` Robin Vowels
2022-02-27  8:56   ` Jeffrey R.Carter
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox