Tuesday 12 February 2019

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

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...