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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: "J-P. Rosen" Newsgroups: comp.lang.ada Subject: Re: GNAT vs Matlab - operation on multidimensional complex matrices Date: Tue, 24 Mar 2020 07:40:28 +0100 Organization: Adalog Message-ID: References: <6c2c0e35-af07-4169-8be5-464ec7fd0fd5@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Tue, 24 Mar 2020 06:40:27 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="d1516d46a2481617a77837c2676c0502"; logging-data="30335"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19b/OzmF1TDY4mWcz8DI3my" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 Cancel-Lock: sha1:lF8kar5DxeA431JUb4/2Cuw5CIc= In-Reply-To: <6c2c0e35-af07-4169-8be5-464ec7fd0fd5@googlegroups.com> Content-Language: fr Xref: reader01.eternal-september.org comp.lang.ada:58232 Date: 2020-03-24T07:40:28+01:00 List-Id: Le 24/03/2020 à 00:16, darek a écrit : > Hi Everyone, > I am working on radar signal processing algorithms that use multidimensional complex arrays. > > To my surprise, the performance of some Matlab functions is much better than compiled Ada code. > [...] Two remarks: 1) why do you need pointers? Ada is very good at using pointer only when absolutely necessary, which is good for safety and efficiency. 2) you are comparing a hand-written, naive[1] algorithm with a specialized function that may well be written in assembly language, making use of special SIMD instructions. I would say that Ada does not behave that bad... [1] Naive in that you simply use the "obvious" loops. If you want maximum efficiency, a lot of tricky factors come into play. For example, changing the order of the nesting of the loops changes the spread of memory accesses, which can (or not) have a dramatic effect on efficiency, given the various caches, whether successive memory accesses belong to the same memory bank, etc. High efficiency mathematical libraries are designed to consider these effects. -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00 http://www.adalog.fr