From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=0.1 required=3.0 tests=BAYES_00,FROM_SUSPICIOUS_NTLD, FROM_SUSPICIOUS_NTLD_FP autolearn=no autolearn_force=no version=3.4.6 Path: eternal-september.org!reader02.eternal-september.org!aioe.org!BeRm+3HNoHPwf8prYVNpnQ.user.46.165.242.75.POSTED!not-for-mail From: Fernando Oleo Blanco Newsgroups: comp.lang.ada Subject: Re: Comparing languages wrt energy, speed, and memory use Date: Thu, 24 Feb 2022 10:13:46 +0100 Organization: Aioe.org NNTP Server Message-ID: <20220224101346.1a70a96a@linux.fritz.box> References: <0d1a120a-d446-4a15-a1b2-d1b1c5d8b465n@googlegroups.com> <20220222211015.1cdb2a27@linux.fritz.box> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: gioia.aioe.org; logging-data="55496"; posting-host="BeRm+3HNoHPwf8prYVNpnQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org"; X-Newsreader: Claws Mail 4.0.0 (GTK+ 3.24.31; x86_64-suse-linux-gnu) X-Notice: Filtered by postfilter v. 0.9.2 Xref: reader02.eternal-september.org comp.lang.ada:63566 List-Id: Hi, answer is interlaced with your text. Am Thu, 24 Feb 2022 08:42:40 +0100 schrieb "G.B." : > 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?) >=20 True, that is the case of GMP for some multiprecission test... Some languages use it, other implement the algorithms themselves... >=20 > Can you be specific? For example, at least one program currently > leads by making extensive use of x86 intrinsic ops. >=20 > Some use OMP with intrinsic 128bit ops. Does GNAT have a similar > parallel loop in the language yet? >=20 Yes, take a look at https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/nbody-g= nat-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. >=20 > 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=3Divybridge now, so the hardware has likely changed. >=20 > > 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) >=20 > GNAT User's Guide explains. (su-p-press and front end i-N-lining) >=20 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. >=20 > How would Fortran do much better? Can Ada learn from that? >=20 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.page= s.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.page= s.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.page= s.debian.net/benchmarksgame/which-programs-are-fastest.html These are the current results: https://benchmarksgame-team.pages.debian.net/benchmarksgame/box-plot-summar= y-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. >=20 > Controversies add to the management's keeping this a lively benchmark. >=20 > > Ada has > > been left behind since very few or nobody is actually taking a look > > at the code and optimising it... >=20 > 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. >=20 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=C3= =A4t M=C3=BCnchen)) 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