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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,be98569334bf359 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!n11g2000yqb.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: C++ threads vs. Ada tasks - surprised Date: Mon, 17 Aug 2009 01:14:22 -0700 (PDT) Organization: http://groups.google.com Message-ID: <05f693d4-2696-4b5f-be0a-c38904fa9170@n11g2000yqb.googlegroups.com> References: NNTP-Posting-Host: 137.138.182.236 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1250496862 7667 127.0.0.1 (17 Aug 2009 08:14:22 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 17 Aug 2009 08:14:22 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: n11g2000yqb.googlegroups.com; posting-host=137.138.182.236; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:7837 Date: 2009-08-17T01:14:22-07:00 List-Id: On 17 Sie, 09:12, Stephen Leake wrote: > You could explain this by saying the Ada implementation took advantage > of what it knows about tasking, while the C++ implementation did _not_ > take advantage of any knowledge about the Posix tasking API. Exactly, but that was the point of the exercise. In theory the applicability of compiler tricks is the same and the C++ compiler could do them as well, but in practice it does not. BTW - I have tried to make it more difficult for Ada by splitting the program into separate units (buffer, producer and consumer all in separate packages), but the result was the same. > I guess the issue is "what compiler/run-time tricks were used to make > the Ada code faster than the simple calls to Posix"? Right, this is my question. Another idea that comes to my mind is that the Ada version might be using spinlocks instead of immediate conditional wait, which in this particular scenario would exclude condvars altogether. Again, some insight from the GNAT implementers will be appreciated. -- Maciej Sobczak * www.msobczak.com * www.inspirel.com Database Access Library for Ada: www.inspirel.com/soci-ada