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.8 required=5.0 tests=BAYES_00,FROM_ADDR_WS, INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!mcnc!uvaarpa!vger.nsu.edu!g_harrison From: g_harrison@vger.nsu.edu ((George C. Harrison) Norfolk State University) Newsgroups: comp.lang.ada Subject: Re: LRM 4.1.3 paragraphs 17-19 Message-ID: <631.27b781ac@vger.nsu.edu> Date: 12 Feb 91 09:48:28 GMT References: <1991Feb8.063458.850@kestrel.edu> <1991Feb09.023913.524@mojsys.com> <2704@sparko.gwu.edu> Distribution: usa List-Id: In article <2704@sparko.gwu.edu>, mfeldman@seas.gwu.edu (Michael Feldman) writes: > What I figure could start a new thread is this: in your experience, what are > the sequential Ada constructs that (may) lead to _better_ optimized code > than the "old way" would? What do you mean by "_better_ optimized code?" If you mean what constructs _might_ lead the compiler to produce more optimized code than the "Brute Force" methods like in the example of this original posting, I'd agree with your assessment below. "Optimized" to programmers generally means what the compiler (and often the linker) does to make a faster, smaller executable. These constructs, I believe, leave their implementations better open to these optimizations. > IMHO aggregates, universal assignment (i.e. > assignment operator for structured types) and universal equality are three > such things. The other kind of optimization is that which saves the programmers time and makes him/her more effective. These include generics, separate compilation, exceptions, overloading, and other supports for abstraction. The problem is that this kind of programmer optimization does not necessarily lead to executable optimization. As an example... Suppose I have a generic package "MATRIX_OPS" that performs operations on matrices with elements from an instantiated field of elements. By using (and "withing") this package I can solve the system of linear equations "Coefficient_Matrix * Unknowns_Vector = Constant_Vector" by simply doing Unknowns_Vector := Coefficient_Matrix ** (-1) * Constant_Vector That CERTAINLY can save a programmer a lot of time, and with some guarantees of correctness, it will save his/her job. However, the implementation of the exceptions involved, the operators * and **, the hidden implementation of the underlying field, etc. may have been done by someone else with only abstraction in mind. Ada, unlike most other languages, seems to be (or is getting to be) very programmer-dependent. That is, as the compilers and program libraries start maxing out on optimization, then programmers can really take great pride in using abstractions effectively. I hope I havn't changed Mike's change-in-thread topic, but I thought it important to make a note on the two kind of optimizations. -- George C. Harrison -------------- || -- My opinions and observations -- ---|| Professor of Computer Science || -- Only. ------------------------- ---|| Norfolk State University, ---- || ----------- Pray for Peace ------- ---|| 2401 Corprew Avenue, Norfolk, Virginia 23504 ----------------------- ---|| INTERNET: g_harrison@vger.nsu.edu ---------------------------------