Skip to content

Conversation

@kjvalencik
Copy link
Member

Currently, Neon pessimistically assumes that JavaScript runtimes may choose to execute from different threads. The specification only defines serial execution and not necessarily single threaded execution.

In practice, this will always be one thread. V8 makes heavy usage of TLS and it would be a large lift to start doing things differently.

This PR changes Neon to optimistically assume the runtime will always execute from the same thread. As a small level of protection, I added SendWrapper when debug_assertions are enabled. This will panic if the single-thread invariant is violated.

@kjvalencik kjvalencik force-pushed the kv/unnecessary-send branch 2 times, most recently from e18e73a to c921014 Compare April 14, 2023 16:26
Copy link
Collaborator

@dherman dherman left a comment

Choose a reason for hiding this comment

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

LGTM! I found it slightly confusing that the debug-only version of send_wrapper is also called send_wrapper, but I don't feel too strongly about it.

@kjvalencik kjvalencik force-pushed the kv/unnecessary-send branch from c921014 to a278678 Compare April 14, 2023 16:45
@kjvalencik kjvalencik force-pushed the kv/unnecessary-send branch from a278678 to 36a57a3 Compare April 14, 2023 16:50
@kjvalencik kjvalencik merged commit a40c012 into main Apr 14, 2023
@kjvalencik kjvalencik deleted the kv/unnecessary-send branch April 14, 2023 17:00
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