Archived

This topic is now archived and is closed to further replies.

speed, baby!

This topic is 5825 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, does anybody know? Are references slower or faster than pointers when being passed to functions? And I''m told that using 32-bit (int) variables is best for some reason... is this true? Why? Does this mean that i shouldnt even use bool variables to set simple flags? ...go on and live with no regrets, you only have one life...

Share this post


Link to post
Share on other sites
References basically are pointers. Look at the assembly code produced by each. 32bit variables are fastest for 32bit processors. I still use single byte boolean variables when I only need to store a true/false value since I obviously won''t be doing a lot of work with any such variable (It''s not as if you''re doing math with them ).

[Resist Windows XP''s Invasive Production Activation Technology!]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
If you are wanting to send simple true/false flags, then use a 32 bit integer, and have each flag represent one bit. Then just OR together the flags you want, and you can send up to 32 flags with one variable. Much faster then a load of bool''s.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I saw it somewhere in a book or website that references were
slightly faster than pointers. They had graphs of speed and
such. Look it up.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
"thanks a lot... but i like to lay off looking at assembly code..
makes me nautious. :p"

What??? You mean you don''t convert the C/C++ to asm in
your head as you write it?

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
I saw it somewhere in a book or website that references were
slightly faster than pointers. They had graphs of speed and
such. Look it up.

They were horribly mistaken (or your misinterpreted what they were saying). I just ran a test (although I personally didn''t need to see it) and they were exactly the same speed. If you want the source, I''ll post it (it''s short, but not so short that I''d post it without need to ).

[Resist Windows XP''s Invasive Production Activation Technology!]

Share this post


Link to post
Share on other sites