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

Added extra variable to loop to not run strlen on each iteration #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

boginw
Copy link

@boginw boginw commented Jun 11, 2018

The strlen in the condition of the for-loop in the setup() function is run on every iteration. As always when dealing with strings, it can be slow. Therefore, I'd suggest running the strlen once and storing the result somewhere. This will lead to the same result, but faster.

@boginw boginw changed the title Added extra variable to loop to not run strlen for each iteration Added extra variable to loop to not run strlen on each iteration Jun 11, 2018
@beneater
Copy link
Owner

Good suggestion. I'll leave the PR open so it's easier for other people to see, but I'd prefer for the code in the repo to match what was in the video, so I won't merge.

@beneater beneater mentioned this pull request Jul 11, 2018
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