From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.0 required=3.0 tests=BAYES_20 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 17 Sep 92 22:08:46 GMT From: sdd.hp.com!wupost!waikato.ac.nz!pdenize@hplabs.hpl.hp.com Subject: Performance Analysis in Vax Ada Message-ID: <1992Sep18.100846.10845@waikato.ac.nz> List-Id: I was performing some Performance analsys and discovered something that I thought was quite wrong. The analysis is presented in simplified form below. What is indicated is that initializing an array with a loop 11: For x in large_matrix'range(1) loop 12: For y in large_matrix'range(2) loop 14.4% *** -> 13: my_large_matrix (x,y) := 0; 4.4% * 14: end loop; 15: end loop; was somewhat faster than an assignment using others in the array aggregate 27.5% ******* -> 29: my_large_matrix := large_matrix'(others=>(others=>0 )); Can anyone suggest why? Paul Denize ----------------------------------------------------------------------------- VAX Performance and Coverage Analyzer 1: with text_io; 2: 3: Procedure Thrasher is 4: 5: type large_matrix is array (1..500,1..1000) of Inte ger; 6: 7: my_large_matrix : large_matrix; 8: 9: Procedure XY_Initialize is 10: Begin 11: For x in large_matrix'range(1) loop 12: For y in large_matrix'range(2) loop 14.4% *** -> 13: my_large_matrix (x,y) := 0; 4.4% * 14: end loop; 15: end loop; 16: End; 17: 18: Procedure YX_Initialize is 19: Begin 20: For y in large_matrix'range(2) loop 21: For x in large_matrix'range(1) loop 11.3% *** 22: my_large_matrix (x,y) := 0; 12.0% *** -> 23: end loop; 24: end loop; 25: End; 26: 27: Begin 28: text_io.put_line ("Zero Matrix"); 27.5% ******* -> 29: my_large_matrix := large_matrix'(others=>(others=>0 )); 30: text_io.put_line ("Zero looping second array index faster"); 31: XY_Initialize; 32: text_io.put_line ("Zero looping first array index f aster"); 33: YX_Initialize; 34: End; ----------------------------------------------------------------------------- -------------------------------------------------------------------------- Paul Denize Internet: PDenize@Waikato.ac.nz Department of Computer Science University of Waikato phone: ++64 7 8562-889 Hamilton Ext 8743 NEW ZEALAND fax : ++64 7 8560-135 --------------------------------------------------------------------------