From: sdd.hp.com!wupost!waikato.ac.nz!pdenize@hplabs.hpl.hp.com
Subject: Performance Analysis in Vax Ada
Date: 17 Sep 92 22:08:46 GMT [thread overview]
Message-ID: <1992Sep18.100846.10845@waikato.ac.nz> (raw)
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
--------------------------------------------------------------------------
reply other threads:[~1992-09-17 22:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox