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=ham 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,UTF8 Path: g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Need some light on using Ada or not Date: Sat, 19 Feb 2011 14:25:17 +0000 Organization: A noiseless patient Spider Message-ID: References: <4d5ef836$0$23753$14726298@news.sunsite.dk> <4d5f079f$0$6990$9b4e6d93@newsspool4.arcor-online.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: mx01.eternal-september.org; posting-host="dFCm8HWntFqmDIilBLqEJQ"; logging-data="4086"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+6CucUFvaFLW4S0WFsYna1qQhs9E6bO9E=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (darwin) Cancel-Lock: sha1:GA6ydWzdCBt2O1GgHkQUIYWU+wY= sha1:SZF4/idulVfd62MMqy8tlYJ1fss= Xref: g2news1.google.com comp.lang.ada:17450 Date: 2011-02-19T14:25:17+00:00 List-Id: Georg Bauhaus writes: > On 2/18/11 11:52 PM, 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? >> Please see: http://shootout.alioth.debian.org/u64q/benchmark.php? >> test=all&lang=gnat >> where for some tests, Ada is 2x, 3x, 4x and 5x slower. > > I happen to know the details of the 3x case (and mention > for the record that there are 6 more Ada programs running at ±1x). > The 3x program, regex-dna, has two parts: string search and > string replacement. At the moment, regex-dna is timed at 33.01 for GNAT, 5.76 for C++ GNU G++. However - the G++ code relies on a library which is not supplied as part of the compiler, re2. I found it on Google Code and downloaded it. It appeared to build OK, but when building the benchpark against it there was an error (OK, could have been because I'm using GCC 4.6.0 experimental): diff -r 160e31271912 re2/stringpiece.h --- a/re2/stringpiece.h Tue Feb 01 11:09:33 2011 -0500 +++ b/re2/stringpiece.h Sat Feb 19 14:22:52 2011 +0000 @@ -117,7 +117,7 @@ typedef const char& reference; typedef const char& const_reference; typedef size_t size_type; - typedef ptrdiff_t difference_type; + typedef std::ptrdiff_t difference_type; static const size_type npos; typedef const char* const_iterator; typedef const char* iterator; Admittedly, after that it built & ran OK...