Skip to content

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

Open
boginw wants to merge 1 commit intobeneater:masterfrom
boginw:master
Open

Added extra variable to loop to not run strlen on each iteration#1
boginw wants to merge 1 commit intobeneater:masterfrom
boginw:master

Conversation

@boginw
Copy link
Copy Markdown

@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
Copy Markdown
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