-
-
Notifications
You must be signed in to change notification settings - Fork 111
refactor: small improvements #539
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
Conversation
Uzlopak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not test my suggestions...
Co-authored-by: Aras Abbasi <[email protected]> Signed-off-by: Matteo Pietro Dazzi <[email protected]>
|
I had to remove the |
|
which test would have failed when doing |
|
There was a problem hiding this 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 introduces small performance and code quality improvements to the fastify-static plugin, including optimizing property access patterns and replacing function calls with direct object lookups.
- Replaced multiple conditional assignments with nullish coalescing operators for cleaner code
- Optimized encoding extension lookup by replacing function calls with direct object mapping
- Improved loop performance by caching url.length in a variable
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
PR to introduce small improvements, like reading the
url.lengthjust once and avoid invoking a function to retrieve the encoding extension.Checklist
npm run test && npm run benchmark --if-presentand the Code of conduct