comp.lang.ada
 help / color / mirror / Atom feed
From: Maciej Sobczak <see.my.homepage@gmail.com>
Subject: Re: C++ threads vs. Ada tasks - surprised
Date: Mon, 17 Aug 2009 01:14:22 -0700 (PDT)
Date: 2009-08-17T01:14:22-07:00	[thread overview]
Message-ID: <05f693d4-2696-4b5f-be0a-c38904fa9170@n11g2000yqb.googlegroups.com> (raw)
In-Reply-To: ueiraykv6.fsf@stephe-leake.org

On 17 Sie, 09:12, Stephen Leake <stephen_le...@stephe-leake.org>
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



  reply	other threads:[~2009-08-17  8:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-16 21:34 C++ threads vs. Ada tasks - surprised Maciej Sobczak
2009-08-17  7:12 ` Stephen Leake
2009-08-17  8:14   ` Maciej Sobczak [this message]
2009-08-17 19:44   ` vlc
2009-08-17  8:04 ` Frederik Sausmikat
2009-08-17  8:17   ` Maciej Sobczak
2009-08-17  8:28   ` Tomek Wałkuski
2009-08-17  9:39     ` Frederik Sausmikat
2009-08-17  9:44       ` Ludovic Brenta
2009-08-17 11:12 ` John McCabe
2009-08-17 15:20 ` John B. Matthews
2009-08-18 20:36 ` Ira Baxter
replies disabled

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