From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: border2.nntp.dca.giganews.com!nntp.giganews.com!goblin3!goblin.stu.neva.ru!gandalf.srv.welterde.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Benchmark Ada, please Date: Sat, 05 Jul 2014 17:33:31 +0100 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx05.eternal-september.org; posting-host="117da9042fa4d6f5956a9b8f72035635"; logging-data="14243"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1890VfbcVrlnZX4Rh7eIKxP/tOM4TgCu/c=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (darwin) Cancel-Lock: sha1:URv1wb41rQWt1++fOnyx7/GBcDM= sha1:ZnXv5I4vXYdqlRum8Toq1tDAXgQ= Xref: number.nntp.dca.giganews.com comp.lang.ada:187377 Date: 2014-07-05T17:33:31+01:00 List-Id: Guillaume Foliard writes: I did much the same as you. I wish I'd started from the F90 version rather than the C++ one, it's *much* cleaner. > Here are the numbers with GNAT GPL 2014 on a Core2 Q9650 @ 3.00GHz: > > $ gnatmake -O3 rbc_ada.adb > $ time ./rbc_ada > ... > Elapsed time is = 1.966112682 > > > As for the C++ version: > > $ g++ -o testc -O3 RBC_CPP.cpp > $ time ./testc > ... > Elapsed time is = 3.12033 > > So the Ada version is significantly faster. I suppose it is mainly because > the Ada compiler has vectorized more loops than the C++ compiler (add - > ftree-vectorizer-verbose=2 to the above compilation commands to check by > yourself). On Mac OS X (2.5 GHz Intel Core i5) I found the reverse, both with FSF GCC 4.9.0 and GNAT GPL 2014; C++ took ~ 1s, Ada took ~ 2s. With GCC 4.9.0, gfortran was approximately the same as C++. Apple's C++ (Xcode 5.1.1) was approximately the same as GCC's. -ftree-vectorizer-verbose=2 had no effect with FSF GCC.