Skip to content

Cache strlen(status) to avoid repeated calls in loop#21526

Closed
arshidkv12 wants to merge 1 commit intophp:masterfrom
arshidkv12:star_len
Closed

Cache strlen(status) to avoid repeated calls in loop#21526
arshidkv12 wants to merge 1 commit intophp:masterfrom
arshidkv12:star_len

Conversation

@arshidkv12
Copy link
Copy Markdown
Contributor

No description provided.

@arshidkv12 arshidkv12 requested a review from bukka as a code owner March 25, 2026 15:23
@devnexen
Copy link
Copy Markdown
Member

These changes are fine, but of very little consequence. Note it s done at (FPM) startup time not runtime.

@iluuu1994
Copy link
Copy Markdown
Member

This looks unnecessary. In these cases, the compiler can infer status and ping don't change in the loop body, and as such will move the strlen() out of the loop. See https://en.wikipedia.org/wiki/Loop-invariant_code_motion.

@iluuu1994 iluuu1994 closed this Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants