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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ad4585f2971e47c5 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!feeder.news-service.com!216.196.110.144.MISMATCH!border3.nntp.ams.giganews.com!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.bt.com!news.bt.com.POSTED!not-for-mail NNTP-Posting-Date: Sat, 19 Feb 2011 12:22:56 -0600 From: Brian Drummond Newsgroups: comp.lang.ada Subject: Re: Need some light on using Ada or not Date: Sat, 19 Feb 2011 18:25:44 +0000 Reply-To: brian@shapes.demon.co.uk Message-ID: References: <4d5ef836$0$23753$14726298@news.sunsite.dk> <7ibvl6tn4os3njo3p4kek9kop44nke3n7t@4ax.com> <4d5fd57d$0$6992$9b4e6d93@newsspool4.arcor-online.net> X-Newsreader: Forte Agent 1.7/32.534 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Usenet-Provider: http://www.giganews.com X-AuthenticatedUsername: NoAuthUser X-Trace: sv3-DqnFPXMgMFa77whLvNvwJJnJEaMAksTyGWVNSrK92xl4gtUzkkzLiXm7kOHNAqQuq2GShivklJQwcdS!XC3yjp/O2l1w95GhXMW6TfdMtXCAxaBeDNNWnMr+CgHGDXr6zkkKgmpUjAulbogEmTia5MeiCU68!CKo= X-Complaints-To: abuse@btinternet.com X-DMCA-Complaints-To: abuse@btinternet.com X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 4325 Xref: g2news2.google.com comp.lang.ada:18428 Date: 2011-02-19T18:25:44+00:00 List-Id: On Sat, 19 Feb 2011 15:36:45 +0100, Georg Bauhaus wrote: >On 2/19/11 2:07 PM, Brian Drummond wrote: >> On 18 Feb 2011 22:52:38 GMT, "Luis P. Mendes" wrote: > >>> I have some questions, however, that I'd like to be answered: >>> 1. If Ada is more type safe and restricted than C++, how can it be >>> significantly slower? >> Two possible reasons; both come down to the relative number of people developing >> for both languages. > >Some reasons are pretty simple: when the results are due >to specialized libraries used, rather than a consequence >of the properties of the respective language (built in >storage management features in this test). (Also interesting: >The Java versions vary widely, and some are fast even though >the solutions uses plain Java.) The leading C and C++ >entries win by making these choices: > >C #includes , that is, it exercises the Apache memory pool, >not what is available with plain C. > >C++ #includes a similar thing from the Boost libraries. > >This is allowed by the test's rules and authorities, even though you are not allowed to supply your own pool. Possibly harsh, but I can see the logic behind it. >> Single processor, the Ada version is just 38% slower, with half the memory >> footprint; probably a damn good compromise between footprint and speed. >> However the C++ version exploits 4 cores. Given Ada's support for concurrent >> tasks, that suggests some room for improvement... Actually there is more to this ... I was erroneously confusing the "cpu time" for the 4-processor code with the single-processor result which is actually presented on another page. 4-core: http://shootout.alioth.debian.org/u64q/performance.php?test=binarytrees C++: 26.99s CPU time, 8.40s elapsed. Ada: 37.45s CPU time, 37.47s elapsed. 1-core: http://shootout.alioth.debian.org/u64/performance.php?test=binarytrees C++: 17.29s CPU time, 17.31s elapsed. Ada: 37.42s CPU time, 37.44s elapsed. So (a) even single-core, there is 2:1 between them. (b) performance scales poorly; I would guess the multicore version is thrashing the cache, and memory bandwidth is the limitation. >I vaguely remember that it has been tried before, but so far there >is no better solution. That makes me feel better... I have broken down and finally started to learn Ada's tasking. So far I have gone from 56s (CPU) 56s (elapsed) with one task, to 120s (CPU), 64s(elapsed) with multiple tasks (on a smallish 2-core laptop)... Disappointing. (If anybody's interested, I am using 9 tasks, one per "Depth" value in the main while loop. The basic pattern is shown on p.488 of Barnes, Ada 2005. Iterate over the tasks, providing their start values. Iterate again, collecting results. I think the next step will be to collect results asynchronously when each task finishes, using a protected object.). But I believe you are correct that a better storage pool is probably the answer. Maybe we need an Ada binding to Boost? :-) - Brian