Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested IF Improvement #53

Closed
wants to merge 1 commit into from
Closed

Nested IF Improvement #53

wants to merge 1 commit into from

Conversation

kinncj
Copy link

@kinncj kinncj commented Apr 11, 2012

The code is correct. Just removing the nested IF, because there is no need

@johannes
Copy link
Member

I consider the long line harder to read. The compiler will most likely create the same code ...

@kinncj
Copy link
Author

kinncj commented Apr 11, 2012

I agree, but looking at the performance, when running the first time, if it does not have nested, the performance is higher than the nested. The second time we no longer feel the difference because it is already in memory... and more readable code like Dustin Boswell says

@johannes
Copy link
Member

Did you measure the performance? As said the compiler will produce the same code and even if it wouldn't this would only matter if the item can't be added, which should never happen. So let's keep the better readable code.

@johannes johannes closed this Apr 11, 2012
@kinncj
Copy link
Author

kinncj commented Apr 11, 2012

Ok, i'll accept this, but i agree with Dustin Boswell and Trevor Foucher about Nesting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants