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!goblin1!goblin.stu.neva.ru!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Benchmark Ada, please Date: Sat, 05 Jul 2014 15:00:55 +0200 Organization: Tidorum Ltd Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: individual.net saMfA6b7CsA5f3xPemYusg8mgmhhaJAP7c8KVjOlihL6xFolvG Cancel-Lock: sha1:lc4h5T+lQr/3MBilq6nmSyrqMRw= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: Xref: number.nntp.dca.giganews.com comp.lang.ada:187373 Date: 2014-07-05T15:00:55+02:00 List-Id: On 14-07-05 14:34 , Guillaume Foliard wrote: > Victor Porton wrote: > >> Somebody, write an Ada benchmark for this comparison of programming >> languages: >> >> https://github.com/jesusfv/Comparison-Programming-Languages-Economics > > Here is it: [most of code snipped] > Cpu_Time_End := Ada.Execution_Time.Clock; I have a question about this, see below. > Ada.Text_IO.Put_Line > ("Elapsed time is =" > & Ada.Real_Time.To_Duration (Cpu_Time_End - Cpu_Time_Start)'Img); > end Rbc_Ada; > --------------------------------------------------------------------- > > This is mostly a line to line translation from RBC_CPP.cpp. I have > added a few type declarations though. > >> It seems that C++ was the fastest (faster than Fortran), but Ada may be >> even faster. > > 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 Are you sure that Ada.Execution_Time.Clock gives numbers that can be compared with the get_cpu_time() function in the C++ version? For a program running under an OS, it is not evident what should be included in the "processor time" for a program (program loading, process creation, interrupts, I/O, page faults, ...). What did the "time" command output in your tests? Just to be sure that the claim "Ada is faster" is really motivated. Which would be very nice. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .