comp.lang.ada
 help / color / mirror / Atom feed
From: Guillaume Foliard <guifo@wanadoo.fr>
Subject: Re: Benchmark Ada, please
Date: Sat, 05 Jul 2014 20:50:16 +0200
Date: 2014-07-05T20:50:16+02:00	[thread overview]
Message-ID: <lp9hd5$8ro$1@speranza.aioe.org> (raw)
In-Reply-To: c1qug1FcogaU1@mid.individual.net

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

  parent reply	other threads:[~2014-07-05 18:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-04 17:23 Benchmark Ada, please Victor Porton
2014-07-05 12:34 ` Guillaume Foliard
2014-07-05 13:00   ` Niklas Holsti
2014-07-05 17:00     ` Guillaume Foliard
2014-07-05 18:29       ` Niklas Holsti
2014-07-05 18:44         ` Niklas Holsti
2014-07-05 18:50         ` Guillaume Foliard [this message]
2014-07-05 19:09           ` Niklas Holsti
2014-07-05 16:33   ` Simon Wright
2014-07-05 18:25     ` Guillaume Foliard
2014-07-06 17:24   ` Dirk Heinrichs
replies disabled

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