Sunday, September 23, 2018

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

plot explanation - Why did Peaches&#39; mom hang on the tree? - Movies &amp; TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...