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

refactor(ops): allow 2 generic deserializable args #10448

Merged

Conversation

AaronO
Copy link
Contributor

@AaronO AaronO commented Apr 30, 2021

Now that ZeroCopyBuf is natively supported in serde_v8 we no longer need to constrain ourselves to 1 structured arg and 1 buf arg, users are free to use their 2 args however they like.

Follow up to #10432

Notes

  • Since the args are generic we can no longer meaningfully track metrics' bytesSentData (CC @lucacasonato)
  • There's been debate about raising the op arity from 2 to 3, I'm keeping it at 2 for retro-compat, might consider 3 down the line after evaluating the number of ops that would benefit from it and whether they're in hot paths

Now that `ZeroCopyBuf` is natively supported in `serde_v8` we no longer need to constrain ourselves to 1 structured arg and 1 buf arg, users are free to use their 2 args however they like.
bytesSentData is always 0 since we can no longer meaningfully inspect the buffer arg since it's generic
@bartlomieju
Copy link
Member

Does this PR mean that users can send two payload (JS objects) instead of payload + zero copy buffer?

@AaronO
Copy link
Contributor Author

AaronO commented May 3, 2021

Does this PR mean that users can send two payload (JS objects) instead of payload + zero copy buffer?

Yes, or 2 ZeroCopyBuffers. Both opcall arguments can now contain "anything" deserializable, which includes structs/tuples/arrays/ZeroCopyBufs (ZeroCopyBufs can be nested in tuples/structs etc...)

@bartlomieju
Copy link
Member

Does this PR mean that users can send two payload (JS objects) instead of payload + zero copy buffer?

Yes, or 2 ZeroCopyBuffers. Both opcall arguments can now contain "anything" deserializable, which includes structs/tuples/arrays/ZeroCopyBufs (ZeroCopyBufs can be nested in tuples/structs etc...)

Is there specific use case you have in mind for such approach? I'm worried it will lead to some ops using 2 JS objects as args without a good reason.

Copy link
Member

@piscisaureus piscisaureus left a comment

Choose a reason for hiding this comment

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

LGTM

@piscisaureus piscisaureus merged commit 1e8e44f into denoland:main May 6, 2021
@AaronO AaronO deleted the refactor/ops-generic-deserializable-args branch May 6, 2021 18:05
AaronO added a commit to AaronO/deno that referenced this pull request May 17, 2021
piscisaureus pushed a commit that referenced this pull request May 18, 2021
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.

None yet

3 participants