Skip to content
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

feat(hooks): Performance improvements #106

Merged
merged 1 commit into from
Feb 7, 2023
Merged

feat(hooks): Performance improvements #106

merged 1 commit into from
Feb 7, 2023

Conversation

daffl
Copy link
Member

@daffl daffl commented Feb 7, 2023

This pull request removes the copyToSelf method. The main reason it was added was to have all inherited properties available directly on the hook context instead of the prototype chain so you will see them right away if you console.log the context object. However, a performance analysis showed that this part is eating up over 60% of the overall hook runtime:

Screenshot 2023-02-06 at 4 36 39 PM

Inherited properties (like ctx.method) can still be accessed directly so this change won't have any actual breaking changes. In Feathers benchmarks this improved the Koa throughput from 33k requests/second to 39k and for Socket.io from 72k to ~83k requests/second.

@daffl daffl changed the title feat(hooks): Big performance improvement feat(hooks): Performance improvements Feb 7, 2023
Copy link
Member

@marshallswain marshallswain left a comment

Choose a reason for hiding this comment

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

:shipit:

@daffl daffl merged commit c14d07c into main Feb 7, 2023
@daffl daffl deleted the performance-boost branch February 7, 2023 17:06
@fratzinger
Copy link
Member

Nice! 😍

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