-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Improve event processing performance #153
Conversation
Test code:
|
Remove the |
It does slow the runtime, but I'm only visualizing inside the |
1cdb989
to
8d9d871
Compare
@@ -123,8 +123,16 @@ export const updateState = async (state, result, setResult, router, socket) => { | |||
* @param setResult The function to set the result. | |||
* @param endpoint The endpoint to connect to. | |||
*/ | |||
export const connect = async (socket, state, setResult, endpoint) => { | |||
export const connect = async (socket, state, result, setResult, router, endpoint) => { | |||
// Create the socket. | |||
socket.current = new WebSocket(endpoint); |
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.
Will we eventually change this so its on socket per app
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'm not sure tbh, we will need to investigate this.
@@ -851,8 +851,16 @@ def format_state(value: Any) -> Dict: | |||
Raises: | |||
TypeError: If the given value is not a valid state. | |||
""" | |||
# Handle dicts. |
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.
Nice the reordering speed up
super().__getattribute__
in functions in the critical path of event processing. It's ugly but it's faster.onopen
for web socket to hydrate the page on initial load.