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.0 required=5.0 tests=BAYES_00,FORGED_HOTMAIL_RCVD2, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,7acba51c7f27ee27 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Received: by 10.68.238.67 with SMTP id vi3mr7087714pbc.6.1337196363478; Wed, 16 May 2012 12:26:03 -0700 (PDT) Path: pr3ni6293pbb.0!nntp.google.com!news1.google.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: gautier_niouzes@hotmail.com Newsgroups: comp.lang.ada Subject: Re: is having a complex type as built-in the languages vs. being in standard package makes performance difference? Date: Wed, 16 May 2012 12:26:03 -0700 (PDT) Organization: http://groups.google.com Message-ID: <20740926.1138.1337196363119.JavaMail.geo-discussion-forums@vbyg17> References: NNTP-Posting-Host: 83.77.72.22 Mime-Version: 1.0 X-Trace: posting.google.com 1337196363 21205 127.0.0.1 (16 May 2012 19:26:03 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 16 May 2012 19:26:03 +0000 (UTC) Cc: nma@12000.org In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=83.77.72.22; posting-account=gRqrnQkAAAAC_02ynnhqGk1VRQlve6ZG User-Agent: G2/1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2012-05-16T12:26:03-07:00 List-Id: Le mercredi 16 mai 2012 20:25:38 UTC+2, Nasser M. Abbasi a =E9crit=A0: > Just a basic question for the experts. >=20 > Ada provides complex data types by a package: >=20 > http://progopedia.com/language/ada/ >=20 > "Ada provides complex datatype, which requires using > packages Generic_Complex_Types and Generic_Complex_Elementary_Functions > and instantiating them with the type of complex number to use" >=20 > While a language like Fortran, complex type is 'built-in' the > language, i.e. part of the language intrinsic data types. >=20 > What I wondered about is: would this makes a difference when it comes > to the performance of generated code that uses these types in > computations? >=20 > i.e. Would the code generated by the compiler by more 'efficient' > somehow if complex was built-in vs. being provided by a package, > or do you think by the time the compiler is done with the code > generation and optimization, then this all becomes irrelevant > 'similar' compiler backend generated code will eventually > result in terms of efficiency of the computation? The chances are better to have efficient machine code when operations on th= ose types are built-in. The good news is that is is possible even by having= to reference a package, thanks to the pragma Intrinsic; see GNAT's package= Interfaces. The fact that a type is immediatly visible or not doesn't chan= ge things. For what matters the Complex types, the pragma Inline on the operators, plu= s the optimizations, are probably sufficient. Did you try to time the same = algorithms with gfortran and gnat (with -gnatpn) and switch on -O3, the SSE= options etc. on both ? > (It might be possible actually to see this using gcc since > it supports both gnat and gfortran as front end?). Sure: compile with -S compile option to keep the assembler output. _________________________=20 Gautier's Ada programming=20 http://sf.net/users/gdemont