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: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: Guillaume Foliard Newsgroups: comp.lang.ada Subject: Re: Benchmark Ada, please Date: Sat, 05 Jul 2014 20:50:16 +0200 Organization: /\/\/\/ Message-ID: References: NNTP-Posting-Host: 5N227f1IERa0rAVWs/hFMg.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Complaints-To: abuse@aioe.org User-Agent: KNode/4.12.5 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:20731 Date: 2014-07-05T20:50:16+02:00 List-Id: Niklas Holsti wrote: >>> On 14-07-05 14:34 , Guillaume Foliard wrote: >> In the >> GNAT GPL 2014 environment have a look at lib/gcc/x86_64-pc-linux- >> gnu/4.7.4/adainclude/a-exetim.adb to notice that yourself. > > I believe you. I was asking if you had checked that the two clock > functions are equivalent. I did not mean to criticize. Oops, I was not expecting my sentence could be interpreted as if I was reacting to a critic. Don't worry, no harsh feelings here... > I know well what "time" does; I asked you to show the values it produced > so that we could see that they, too, show Ada to be faster. If you don't > want to do that, that is your right, of course. Sorry, I misread your question, here are the full outputs: C++: $ time ./testc Output = 0.562731, Capital = 0.178198, Consumption = 0.384533 Iteration = 1, Sup Diff = 0.0527416 Iteration = 10, Sup Diff = 0.0313469 Iteration = 20, Sup Diff = 0.0187035 Iteration = 30, Sup Diff = 0.0111655 Iteration = 40, Sup Diff = 0.00666854 Iteration = 50, Sup Diff = 0.00398429 Iteration = 60, Sup Diff = 0.00238131 Iteration = 70, Sup Diff = 0.00142366 Iteration = 80, Sup Diff = 0.00085134 Iteration = 90, Sup Diff = 0.000509205 Iteration = 100, Sup Diff = 0.000304623 Iteration = 110, Sup Diff = 0.000182265 Iteration = 120, Sup Diff = 0.00010907 Iteration = 130, Sup Diff = 6.52764e-05 Iteration = 140, Sup Diff = 3.90711e-05 Iteration = 150, Sup Diff = 2.33881e-05 Iteration = 160, Sup Diff = 1.40086e-05 Iteration = 170, Sup Diff = 8.39132e-06 Iteration = 180, Sup Diff = 5.02647e-06 Iteration = 190, Sup Diff = 3.0109e-06 Iteration = 200, Sup Diff = 1.80355e-06 Iteration = 210, Sup Diff = 1.08034e-06 Iteration = 220, Sup Diff = 6.47132e-07 Iteration = 230, Sup Diff = 3.87636e-07 Iteration = 240, Sup Diff = 2.32197e-07 Iteration = 250, Sup Diff = 1.39087e-07 Iteration = 257, Sup Diff = 9.71604e-08 My check = 0.146549 Elapsed time is = 3.11317 real 0m3.126s user 0m3.113s sys 0m0.003s Ada: $ time ./rbc_ada Output = 5.62731433873177E-01, Capital = 1.78198287391391E-01, Consumption = 3.84533146481786E-01 Iteration = 1, Sup Diff = 5.27415934068824E-02 Iteration = 10, Sup Diff = 3.13469492655827E-02 Iteration = 20, Sup Diff = 1.87034598931961E-02 Iteration = 30, Sup Diff = 1.11655120338747E-02 Iteration = 40, Sup Diff = 6.66854170807507E-03 Iteration = 50, Sup Diff = 3.98429274868262E-03 Iteration = 60, Sup Diff = 2.38131180391221E-03 Iteration = 70, Sup Diff = 1.42365864508598E-03 Iteration = 80, Sup Diff = 8.51339774713189E-04 Iteration = 90, Sup Diff = 5.09205175224792E-04 Iteration = 100, Sup Diff = 3.04623244212099E-04 Iteration = 110, Sup Diff = 1.82264856321224E-04 Iteration = 120, Sup Diff = 1.09069508725246E-04 Iteration = 130, Sup Diff = 6.52764373626491E-05 Iteration = 140, Sup Diff = 3.90710821196461E-05 Iteration = 150, Sup Diff = 2.33880771197681E-05 Iteration = 160, Sup Diff = 1.40086446370757E-05 Iteration = 170, Sup Diff = 8.39131720298258E-06 Iteration = 180, Sup Diff = 5.02647453792804E-06 Iteration = 190, Sup Diff = 3.01089986365355E-06 Iteration = 200, Sup Diff = 1.80355224810302E-06 Iteration = 210, Sup Diff = 1.08034091594877E-06 Iteration = 220, Sup Diff = 6.47131694342384E-07 Iteration = 230, Sup Diff = 3.87636194032481E-07 Iteration = 240, Sup Diff = 2.32196579297295E-07 Iteration = 250, Sup Diff = 1.39087209638511E-07 Iteration = 257, Sup Diff = 9.71603565380619E-08 My check = 1.46549143695695E-01 Elapsed time is = 1.970120151 real 0m1.982s user 0m1.970s sys 0m0.004s > From other posts it seems that the relative speeds of C++ and Ada for > this benchmark depend on the platform and compiler, which is not very > surprising. Indeed, trying with various other compiler versions leads to somewhat significant differences, mostly caused by the effectiveness of the auto- vectorization. -- Guillaume Foliard