comp.lang.ada
 help / color / mirror / Atom feed
* Re: fastest data structure
@ 2002-12-10 21:51 Gautier direct_replies_not_read
  0 siblings, 0 replies; 13+ messages in thread
From: Gautier direct_replies_not_read @ 2002-12-10 21:51 UTC (permalink / raw)


Etienne Baudin:

>I'd like to know which of these 2 data structures is the fastest to proceed

>an simple array of  "My_type" (My type is a record...)
>or a liked liste of  "My_Type"
>
>with these definitions
>     A : array (integer range <>) of My_Type
>vs
>     type ptr is access cell
>     type cell is record
>         comp : My_Type;
>         next : ptr;
>     end record;
...

From a pifometric point of view, I would say the array - with a 
loop-unrolling
option to the compiler. But it depends on the size of your record, the 3D 
graphics
system, etc. . My guess is that the speed will be very near for the two 
variants.
But, the better is to compare, say with a lot of small faces so you have a 
greater
CPU time for the traversal of your structure and a smaller time for the 
processing,
so you see a bit more the comparison.
HTH
________________________________________________________
Gautier  --  http://www.mysunrise.ch/users/gdm/gsoft.htm

NB: For a direct answer, e-mail address on the Web site!

_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* 
http://join.msn.com/?page=features/junkmail




^ permalink raw reply	[flat|nested] 13+ messages in thread
* fastest data structure
@ 2002-12-10 21:01 Etienne Baudin
  2002-12-10 22:12 ` Victor Porton
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Etienne Baudin @ 2002-12-10 21:01 UTC (permalink / raw)


Hello,

I'd like to know which of these 2 data structures is the fastest to proceed
:

an simple array of  "My_type" (My type is a record...)
or a liked liste of  "My_Type"

with these definitions
    A : array (integer range <>) of My_Type
vs
    type ptr is access cell
    type cell is record
        comp : My_Type;
        next : ptr;
    end record;

for i in A'range loop
    processing A(i)
end loop;

while (p != null) loop
    process p.comp;
    p := p.next;
end loop;

Which of the loops is supposed to be the fastest ? Each of the loop should
run between 1000 and 10_000 times (faces of a 3d object) many (60 expected)
times per sec, that's why I try to get the best performances.

Thanks
Etienne Baudin





^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2002-12-17  0:33 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-10 21:51 fastest data structure Gautier direct_replies_not_read
  -- strict thread matches above, loose matches on Subject: below --
2002-12-10 21:01 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
2002-12-12 12:40       ` P R Keeble
2002-12-14 16:23       ` Simon Wright
2002-12-17  0:33         ` Randy Brukardt

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