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

Could send take offset + len? #679

Closed
ronag opened this issue Jan 8, 2022 · 4 comments
Closed

Could send take offset + len? #679

ronag opened this issue Jan 8, 2022 · 4 comments

Comments

@ronag
Copy link

ronag commented Jan 8, 2022

It would be nice if I instead of doing this:

ws.send(buf.slice(0, 16)

could do something like:

ws.send(buf, 0, 16)

Skipping the extra Buffer allocation.

@ghost
Copy link

ghost commented Jan 8, 2022

new Uint8Array(buffer, byteOffset, length);

@ronag
Copy link
Author

ronag commented Jan 9, 2022

I was thinking of avoiding that allocation.

@ronag
Copy link
Author

ronag commented Jan 9, 2022

maybe nano optimization

@ronag ronag closed this as completed Jan 9, 2022
@ghost
Copy link

ghost commented Jan 9, 2022

Yeah if allocating a view is a concern then why the heck are you even using JavaScript

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

No branches or pull requests

1 participant