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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5cb36983754f64da X-Google-Attributes: gid103376,public X-Google-Thread: f5d71,304c86061dc69dba X-Google-Attributes: gidf5d71,public X-Google-Thread: 1014db,304c86061dc69dba X-Google-Attributes: gid1014db,public X-Google-Thread: 109fba,304c86061dc69dba X-Google-Attributes: gid109fba,public X-Google-ArrivalTime: 2004-02-11 01:13:54 PST Path: archiver1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!tar-atanamir.cbb-automation.DE!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++,comp.lang.java Subject: Re: No call for Ada (was Re: Announcing new scripting/prototyping language) Date: Wed, 11 Feb 2004 10:22:37 +0100 Message-ID: References: <20040206174017.7E84F4C4114@lovelace.ada-france.org> <54759e7e.0402071124.322ea376@posting.google.com> <2460735.u7KiuvdgQP@linux1.krischik.com> <54759e7e.0402081525.50c7adae@posting.google.com> <54759e7e.0402091826.2847e0c@posting.google.com> <54759e7e.0402101819.95cec1d@posting.google.com> NNTP-Posting-Host: tar-atanamir.cbb-automation.de (212.79.194.116) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de 1076490832 38358049 D 212.79.194.116 ([77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:5422 comp.lang.c:21820 comp.lang.c++:18640 comp.lang.java:2852 Date: 2004-02-11T10:22:37+01:00 List-Id: On 10 Feb 2004 18:19:13 -0800, msg1825@yahoo.com (MSG) wrote: >Dmitry A. Kazakov wrote in message news:... >> On 9 Feb 2004 18:26:33 -0800, msg1825@yahoo.com (MSG) wrote: >> > >> >3. performance is highly important >> >> GNAT is a front end of GNU C... > >Can you write (*) a matrix multiplication routine in Ada, compile it >with GNAT and measure the number CPU cycles per FLOP, compare to a >similar routine in C? There is a problem with that. C does not have arrays. Yet matrices, you know, are two-dimensional ones. So any comparison here would be suspicious. A program in C, supposed to multiply matrices would lack ADT abstraction layer. It is well possible to write something similar in Ada, using pointers instead of arrays etc. (After all true programmer can write a FORTRAN program in Pascal, if I correctly quote the famous sentence) Such a program with all checks surpressed will take the same number of CPU cycles. But who might be interested in such comparison? Note that presence of an abstraction per se does not mean performance penalty. The effect could be quite opposite. The difference between C and Ada is that in C you almost cannot express intention. It is too low-level language. You just order the compiler to do something and it obeys. This may result in slower code, because the compiler should deduce that: char * t; char * s; while (*t++ = *s++); is in fact to copy a string. If it would, it could then apply a corresponding target CISC machine instruction. In Ada it is easier for the compiler: T : String (...); S : String (...); T := S; Even if you work at the array abstraction level: for I in S'Range loop T (I) := S (I); end loop; there is a lot of useful information for the compiler here, much more than in pointer increments and dereferencings. Note also, that by using pointers you commit yourself to only the objects which can be referenced by a pointer. This might be a heavy burden on some machines. Compare this with Ada, where you have to *explicitly* specify that an object is aliased (a subject of referencing). If you don't, the compiler is free to move such objects to registers, cache, an external matrix processing unit etc. Even if GNAT might not use all that, it is at best a GNAT problem, not one of Ada. -- Regards, Dmitry A. Kazakov www.dmitry-kazakov.de