Wednesday, 6 April 2016

c++ - Which algorithm brings the best performance?

I have a piece of code that is really dirty.



I want to optimize it a little bit. Does it makes any difference when I take one of the following structures or are they identical with the point of view to performance in c++ ?



for(unsigned int i = 1; i < entity.size(); ++i) begin

if
if ... else ...
for end

for(unsigned int i = 1; i < entity.size(); ++i) begin
if
if ... else ...
for end

for(unsigned int i = 1; i < entity.size(); ++i) begin

if
if ... else ...
for end
....


or



for(unsigned int i = 1; i < entity.size(); ++i) begin
if

if ... else ...
if
if ... else ...
if
if ... else ...
....
for end


Thanks in Advance!

No comments:

Post a Comment