Skip to content

Conversation

@Fdawgs
Copy link
Member

@Fdawgs Fdawgs commented Nov 29, 2025

Caching the key property is a teeny bit faster as it's not having to do property access.

See https://github.com/kibertoad/nodejs-benchmark-tournament/blob/master/loops/_results/results.md

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 implements a micro-optimization to improve loop performance in the auth function by caching array length properties in local variables before iteration, avoiding repeated property access during loop condition checks.

  • Caches functions.length before the outer loop
  • Caches functions[i].length before each inner loop iteration

💡 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.

Copy link
Member

@gurgunday gurgunday left a comment

Choose a reason for hiding this comment

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

lgtm

@Fdawgs Fdawgs merged commit 1544d27 into main Nov 29, 2025
23 checks passed
@Fdawgs Fdawgs deleted the perf/key-length branch November 29, 2025 10:28
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