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: 103376,e0e1d3b3f7c994b8 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!c33g2000hsd.googlegroups.com!not-for-mail From: george.priv@gmail.com Newsgroups: comp.lang.ada Subject: Re: Robert Dewar's great article about the Strengths of Ada over other langauges in multiprocessing! Date: Tue, 11 Mar 2008 06:58:43 -0700 (PDT) Organization: http://groups.google.com Message-ID: <114f711c-9cf8-4fdb-8f11-77667afb8719@c33g2000hsd.googlegroups.com> References: <13t4b2kkjem20f3@corp.supernews.com> <89af8399-94fb-42b3-909d-edf3c98d32e5@n75g2000hsh.googlegroups.com> <47D39DC8.20002@obry.net> NNTP-Posting-Host: 151.196.71.114 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1205243924 23819 127.0.0.1 (11 Mar 2008 13:58:44 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 11 Mar 2008 13:58:44 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: c33g2000hsd.googlegroups.com; posting-host=151.196.71.114; posting-account=VnNb3AoAAACTpRtCcTrcjmPX7cs92k1Q User-Agent: G2/1.0 X-HTTP-Via: 1.1 SPARKS X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:20294 Date: 2008-03-11T06:58:43-07:00 List-Id: On Mar 9, 8:40 am, Vadim Godunko wrote: > On Mar 9, 11:20 am, Pascal Obry wrote: > > > I prefer using Ada, even losing 10% performance initially. > > I usually have 4+ times penalty for Ada program with controlled object > for memory allocation/deallocation control and protected objects for > thread safe operations in comparison with equivalent C++ program. :-( > > #include > #include > > void test(unsigned length) > { > uint x[length]; > QString a[1024]; > QString b[1024]; > QTime timer; > > timer.start(); > > for (int i = 0; i < 1024; i++) > { > a[i] = QString::fromUcs4(x, length); > } > > qDebug("Init %d %lf", length, (double)timer.elapsed() / 1000); > > timer.restart(); > > for (int i = 0; i < 1000; i++) > { > if (i % 2) > { > for (int j = 0; j < 1024; j++) > { > a[j] = b[j]; > } > } > else > { > for (int j = 0; j < 1024; j++) > { > b[j] = a[j]; > } > } > } > > qDebug("Copy %d %lf", length, (double)timer.elapsed() / 1000); > > } > > int main() > { > test (128); > test (1024); > return 0; > > } > > with Ada.Calendar; > with Ada.Wide_Wide_Text_IO; > > with League.Strings; > > procedure Speed_Test_League is > > type Universal_String_Array is > array (Positive range <>) of League.Strings.Universal_String; > > procedure Test (Length : in Positive); > > procedure Test (Length : in Positive) is > use type Ada.Calendar.Time; > > X : constant Wide_Wide_String (1 .. Length) := (others => ' '); > A : Universal_String_Array (1 .. 1_024); > B : Universal_String_Array (1 .. 1_024); > S : Ada.Calendar.Time; > > begin > S := Ada.Calendar.Clock; > > for J in A'Range loop > A (J) := League.Strings.To_Universal_String (X); > end loop; > > Ada.Wide_Wide_Text_IO.Put_Line > ("Init" > & Positive'Wide_Wide_Image (Length) > & Duration'Wide_Wide_Image (Ada.Calendar.Clock - S)); > > S := Ada.Calendar.Clock; > > for J in 1 .. 1_000 loop > if J mod 2 = 1 then > B := A; > > else > A := B; > end if; > end loop; > > Ada.Wide_Wide_Text_IO.Put_Line > ("Copy" > & Positive'Wide_Wide_Image (Length) > & Duration'Wide_Wide_Image (Ada.Calendar.Clock - S)); > end Test; > > begin > Test (128); > Test (1_024); > end Speed_Test_League; This code is not multi-core safe. Are you sure that QString has Vtab? If not then comparison will be unfair.