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

Move connection hook to improve performance #143

Merged
merged 11 commits into from
Feb 3, 2020
Merged

Conversation

TimGuiteDiamond
Copy link
Contributor

The connection hook is required at runtime, but many of the other hooks (useMacros etc) are not. Therefore, this PR moves the connection hook into a separate widget which is rendered after the load-time hooks in order to separate concerns. This appears to have provided an approximately 36% increase in speed over what is currently on the master branch when measuring both with production build and the profile flag (npm run build -- --profile)

It also does not disrupt our current widget layout but does give us a method for concerning load-time and runtime concerns.

@TimGuiteDiamond
Copy link
Contributor Author

This PR currently prevents us from calculating rules at runtime, but we can't do this effectively anyway for many props (such as position, font etc). I think this should be looked at as a separate concern.

Required mocking out multiple modules which can be reasonably painful. Some improvements could perhaps be made to the implementation
Comment on lines +158 to +159
containerProps: any & { id: string };
widgetProps: any;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would like to stop these allowing any through in the future

@TimGuiteDiamond
Copy link
Contributor Author

image
Time in ms for rendering 100 readbacks widgets, measured 10 times at 1 Hz to allow plenty of time for render to finish before new value change

All readbacks looking at the same PV. Clear speedup from hooked and wrapped components changes. Performance comparable to dbwr for this test.

@willrogers
Copy link
Collaborator

Interesting that this branch improves performance, as it seems a fairly minor change. As the performance is comparable to what you called 'hooked-components' I think this one is more useful.

@willrogers willrogers merged commit 649527b into master Feb 3, 2020
@willrogers willrogers deleted the connect-later branch February 3, 2020 14:53
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.

2 participants