comp.lang.ada
 help / color / mirror / Atom feed
From: "SteveD" <nospam_steved94@attbi.com>
Subject: Re: fastest data structure
Date: Thu, 12 Dec 2002 04:22:21 GMT
Date: 2002-12-12T04:22:21+00:00	[thread overview]
Message-ID: <1aUJ9.318688$NH2.22572@sccrnsc01> (raw)
In-Reply-To: at7k2o$9fb$1@news-reader10.wanadoo.fr

  I am not surprised by your results.

  When more time that is spent in "Processing" a smaller percentage of
overall time is spent in the loop overhead.  When the size of the records is
increased, the time it takes to copy those records is increased.

  Also:  If you're doing serious timing tests it is a good idea to run
enough iterations to get the overal times significantly longer that the
system clock rate.  I usually shoot for overall times of at least a few
seconds.

  Since you seem to be focused on optimizing, I would like to quote from
Meiler Page-Jones "The Practical Guide to Structured Systems Design" (an old
book, but may of the principles still hold).

  Jackson gives two rules for determining when to optimize:
    1. Don't do it.
    2. Don't do it yet.
  Optimize only the parts of a system worth optimizing.  One of the old
systems
  proverbs, the 90-10 rule, says: In a typical application, 90 percent of
the total
  run time is devoted to executing only 10 percent of the code.

  With the added corrolaries (I can't quote the source):
  It's easier to optimize a working system than it is to make an optimized
system work.

Steve
(The Duck)

"Etienne Baudin" <pfoxNO@SPAMfree.fr> wrote in message
news:at7k2o$9fb$1@news-reader10.wanadoo.fr...
> Thanks for answers and the test program. I just modified My_type with a
> record like that
>
> type My_Type is record
>     un : Integer;
>     deux : Integer;
>     trois : Integer;
>     quatre : Integer;
>     cinq : Integer;
>     six : Integer;
>  end record;
>
> and process:
>
>    procedure Processing (Data : My_Type ) is
>       value : Integer;
>       pragma Volatile( Value );
>    begin
>       value := data.un;
>       value := data.un;
>       value := data.un;
>       value := data.un;
>    end Processing;
>
> and I obtained some weird results :
>
> -- when I let the six components in My_type
> Time for array based loop is   0.00151
> Time for linked list based loop is   0.00175
>
> -- with only 3 components in the record
> Time for array based loop is   0.00109
> Time for linked list based loop is   0.00112
>
> --with only 1 component :
> Time for array based loop is   0.00050
> Time for linked list based loop is   0.00047
>
> The process is the same with the 3 test (always reading "un") , and the
> running time seems depend on the record size....??
>
> Etienne Baudin
>
>





  parent reply	other threads:[~2002-12-12  4:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-10 21:01 fastest data structure Etienne Baudin
2002-12-10 22:12 ` Victor Porton
2002-12-11  1:14 ` Jeffrey Carter
2002-12-11  3:23 ` SteveD
2002-12-11 13:03   ` Marin David Condic
2002-12-11 15:02   ` Etienne Baudin
2002-12-11 15:11     ` Lutz Donnerhacke
2002-12-11 19:04     ` tmoran
2002-12-12  4:22     ` SteveD [this message]
2002-12-12 12:40       ` P R Keeble
2002-12-14 16:23       ` Simon Wright
2002-12-17  0:33         ` Randy Brukardt
  -- strict thread matches above, loose matches on Subject: below --
2002-12-10 21:51 Gautier direct_replies_not_read
replies disabled

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