Performance and Ada Style for the AN/BSY-2 Submarine Combat System
Total Page:16
File Type:pdf, Size:1020Kb
Technical Report CMU/SEI-92-TR-032 ESC-TR-92-032 Performance and Ada Style for the AN/BSY-2 Submarine Combat System Neal Altman Patrick Donohoe December 1992 Technical Report CMU/SEI-92-TR-032 ESC-TR-92-032 December 1992 Performance and Ada Style for the AN/BSY-2 Submarine Combat System Neal Altman Patrick Donohoe Real-Time Embedded Systems Testbed (REST) Project Unlimited distribution subject to the copyright. Software Engineering Institute Carnegie Mellon University Pittsburgh, Pennsylvania 15213 This report was prepared for the SEI Joint Program Office HQ ESC/AXS 5 Eglin Street Hanscom AFB, MA 01731-2116 The ideas and findings in this report should not be construed as an official DoD position. It is published in the interest of scientific and technical information exchange. FOR THE COMMANDER (signature on file) Thomas R. Miller, Lt Col, USAF SEI Joint Program Office This work is sponsored by the U.S. Department of Defense. Copyright © 1992 by Carnegie Mellon University. Permission to reproduce this document and to prepare derivative works from this document for internal use is granted, provided the copyright and “No Warranty” statements are included with all reproductions and derivative works. Requests for permission to reproduce this document or to prepare derivative works of this document for external and commercial use should be addressed to the SEI Licensing Agent. NO WARRANTY THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING INSTITUTE MATERIAL IS FURNISHED ON AN “AS-IS” BASIS. CARNEGIE MELLON UNIVERSITY MAKES NO WARRAN- TIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR PURPOSE OR MERCHANTIBILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. This work was created in the performance of Federal Government Contract Number F19628-95-C-0003 with Carnegie Mellon University for the operation of the Software Engineering Institute, a federally funded research and development center. The Government of the United States has a royalty-free government-purpose license to use, duplicate, or disclose the work, in whole or in part and in any manner, and to have or permit others to do so, for government purposes pursuant to the copyright license under the clause at 52.227-7013. This document is available through Research Access, Inc., 800 Vinial Street, Pittsburgh, PA 15212. Phone: 1-800-685-6510. FAX: (412) 321-2994. RAI also maintains a World Wide Web home page. The URL is http://www.rai.com Copies of this document are available through the National Technical Information Service (NTIS). For informa- tion on ordering, please contact NTIS directly: National Technical Information Service, U.S. Department of Commerce, Springfield, VA 22161. Phone: (703) 487-4600. This document is also available through the Defense Technical Information Center (DTIC). DTIC provides ac- cess to and transfer of scientific and technical information for DoD personnel, DoD contractors and potential con- tractors, and other U.S. Government agency personnel and their contractors. To obtain a copy, please contact DTIC directly: Defense Technical Information Center, Attn: FDRA, Cameron Station, Alexandria, VA 22304- 6145. Phone: (703) 274-7633. Use of any trademarks in this report is not intended in any way to infringe on the rights of the trademark holder. Table of Contents 1 Introduction 1 1.1 BSY-2 Performance Questions 2 1.2 Performance Questions List 2 2 Performance Reports 3 2.1 Background 3 2.1.1 BSY-2 Style Guide 3 2.1.2 Benchmark Suites 3 2.1.3 Test Environment 4 2.1.4 Accuracy of Data and Results 4 2.1.5 Question Format 5 2.2 Arrays 7 2.3 Check Suppression 25 2.4 Data Location 31 2.5 Enumeration Types 43 2.6 Exceptions 47 2.7 Generic Units 55 2.8 Inlining of Procedures 63 2.9 Logical Tests 69 2.10 Loop Efficiency 77 2.11 Module Size 85 2.12 Optimization Options 99 2.13 Precision 157 2.14 Private Types 163 2.15 Records 165 2.16 Rendezvous 169 Appendix A BSY-2 Performance Questions 181 A.1 Questions from the SSP Ada Style Guide 181 A.2 SEI Additional Questions 183 A.3 Combined Questions List 187 A.4 Editing the Questions List 192 Appendix B Benchmark Sources 195 B.1 The Ada Evaluation System 195 B.2 The Ada Compiler Evaluation Capability 195 B.3 The PIWG Benchmarks 196 Appendix C Question Format and Instructions 197 C.1 Blank Question Entry 197 i C.2 Instructions for Filling in Questions 197 References 205 Index 207 ii List of Figures Figure 2-1: Summary Graph of AES Tests TI01 and TI02 32 Figure 2-2: Graph of AES Test TI01 Results 33 Figure 2-3: Graph of AES Test TI02 Results 33 Figure 2-4: Graph of PIWG B Test Results 103 CMU/SEI-92-TR-32 iii iv CMU/SEI-92-TR-32 List of Tables Table 1: Generated Code Sizes AES Test TO07 27 Table 2: Execution Times (in Seconds) for PIWG B Tests at Various Optimization Levels 102 Table 3: ACEC Floating-Point Results 159 Table 4: ACEC Integer Results 161 CMU/SEI-92-TR-32 v vi CMU/SEI-92-TR-32 Performance and Ada Style for the AN/BSY-2 Submarine Combat System Abstract: The performance of programs prepared with the Verdix Ada Development System (VADS) was measured and analyzed for programmers preparing a large Ada system. Using standard Ada benchmark suites (ACEC, AES and PIWG) and a representative Motorola 68030 target system as a source of data, questions were posed and answered about programming alternatives, based on the measured performance of the compiler. The questions included in the report were extracted from a much larger set selected from an analysis of the BSY-2 Style Guide and augmented with additional questions suggested by SEI experience. The derivation of the questions and the template for the performance analysis sections are presented as appendices. 1 Introduction The U. S. Navy’s AN/BSY-2 Submarine Combat System will use the Ada programming language for the majority of its software. The coding style used in preparing this software will affect the readability, test- ability and maintainability of the code during the software life cycle. Programming style can also affect the performance of the software in operation. The emphasis of this report is to describe the effect of Ada coding style on the execution performance of Ada programs. Impact on memory utilization is a second- ary concern but is mentioned when appropriate. This report has been organized as a series of questions. Each question provides information about pro- gramming choices. In developing a software system, implementors make a large number of choices about the design and coding of software. Because software is inherently flexible and Ada provides a large number of alternatives to the programmer, the correct or most efficient choice among the alterna- tives is not always known. This report emphasizes the performance consequences of Ada coding choices, rather than character- izing Ada’s performance or comparing Ada to other computer programming languages. It abstracts rel- evant information from Ada benchmark suites and presents those data and a series of conclusions. Performance is, of course, only one aspect to be considered in making programming choices. The code’s consistency, clarity, maintainability, plus other factors, must also be considered. This report is intended to inform rather than dictate. In particular, the intent is to allow rational choices to be made with knowledge of the performance consequences, rather than suggesting that performance is or should be the overriding consideration. Often the differences in performance between alternative choices are shown to be negligible. While the questions asked by this report are intended to be of general interest to Ada users, the con- clusions are only applicable to the tested hardware and software configurations specified in the individ- ual entries. The primary source of performance information is a configuration using the Verdix Ada compiler selected for BSY-2 and commercial-off-the-shelf hardware used for the initial prototype of the BSY-2 system. Where appropriate, conclusions are also drawn from other systems and the work of oth- er government agencies. However, it should be emphasized that these results are specific recommen- dations for BSY-2 and are not universally applicable to all Ada systems or hardware platforms. As new CMU/SEI-92-TR-32 1 system hardware and software are deployed, all relevant tests must be re-executed and the results ex- amined to ensure the recommendations remain current. 1.1 BSY-2 Performance Questions This section presents the performance questions addressed in this report. Appendix A on page 181 de- scribes how the list of questions was selected. Performance information for each question is provided in the body of the report (Performance Reports on page 3). 1.2 Performance Questions List This list is organized alphabetically by topic. 1. Arrays: What are the performance characteristics of array aggregate assignments and corresponding loop constructs? 2. Check Suppression: How does performance change when checks are turned off? 3. Data Location: What is the performance effect of declaring data locally or outside the executing scope? 4. Enumeration Types: How does the performance of operations on objects of an enumeration type compare with the performance of an equivalent representation using strings or numeric values? 5. Exceptions: What are the performance consequences of providing exception handling capabilities? 6. Generic Units: What is the comparative performance of generic and nongeneric units? 7. Inlining of Procedures: What is the effect of inlining procedures and generic procedures? 8.