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!n36g2000hse.googlegroups.com!not-for-mail From: Vadim Godunko Newsgroups: comp.lang.ada Subject: Re: Robert Dewar's great article about the Strengths of Ada over other langauges in multiprocessing! Date: Sun, 9 Mar 2008 05:40:53 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <13t4b2kkjem20f3@corp.supernews.com> <89af8399-94fb-42b3-909d-edf3c98d32e5@n75g2000hsh.googlegroups.com> <47D39DC8.20002@obry.net> NNTP-Posting-Host: 83.221.215.2 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1205066454 18840 127.0.0.1 (9 Mar 2008 12:40:54 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 9 Mar 2008 12:40:54 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: n36g2000hse.googlegroups.com; posting-host=83.221.215.2; posting-account=niG3UgoAAAD7iQ3takWjEn_gw6D9X3ww User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.4) Gecko/20070601 SeaMonkey/1.1.2,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:20250 Date: 2008-03-09T05:40:53-07:00 List-Id: 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;