comp.lang.ada
 help / color / mirror / Atom feed
* Performance Analysis in Vax Ada
@ 1992-09-17 22:08 sdd.hp.com!wupost!waikato.ac.nz!pdenize
  0 siblings, 0 replies; only message in thread
From: sdd.hp.com!wupost!waikato.ac.nz!pdenize @ 1992-09-17 22:08 UTC (permalink / 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
--------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1992-09-17 22:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1992-09-17 22:08 Performance Analysis in Vax Ada sdd.hp.com!wupost!waikato.ac.nz!pdenize

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox