Skip to content

Conversation

@Fdawgs
Copy link
Member

@Fdawgs Fdawgs commented Nov 29, 2025

Similar to fastify/fastify-sensible#138, this PR replaces a forEach loop with a traditional for loop with a cached length, which cuts down on function overhead.

Checklist

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR optimizes performance by replacing forEach loops with traditional for loops and caching the array length to reduce function call overhead.

  • Replaces two forEach loops with for loops that cache the methodNames.length
  • Reduces function overhead during plugin initialization
Comments suppressed due to low confidence (2)

index.js:47

  • Incorrect closing brace. This should be a closing brace for the for loop starting at line 37, so it should be } instead of }).
  })

index.js:65

  • Incorrect closing brace. This should be a closing brace for the for loop starting at line 52, so it should be } instead of }).
    })

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@Fdawgs Fdawgs merged commit 698ecd4 into main Nov 29, 2025
17 checks passed
@Fdawgs Fdawgs deleted the perf/for-loop branch November 29, 2025 15:43
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.

3 participants