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

Use native methods for bit access #70

Closed
SoniEx2 opened this issue Sep 5, 2015 · 4 comments
Closed

Use native methods for bit access #70

SoniEx2 opened this issue Sep 5, 2015 · 4 comments

Comments

@SoniEx2
Copy link

SoniEx2 commented Sep 5, 2015

https://github.com/jDataView/jDataView/blob/master/src/jdataview.js#L574

_getBytes produces unnecessary garbage. Please use native methods when possible. (e.g. if bitLength <= 8 use getUint8, if bitLength <= 16 use getUint16, etc)

@RReverser
Copy link
Member

Again - why? This will slow down things on most platforms and make code much more polluted.

@SoniEx2
Copy link
Author

SoniEx2 commented Sep 5, 2015

How will it slow down things on most platforms?

@RReverser
Copy link
Member

I already said in another thread - native get* DataView methods are slower, so doesn't make sense to use them when you can just take a needed slice of bytes on original buffer (this doesn't even create a copy, just another view on same memory unless your platform supports only Array and nothing else) and use fast bitwise operations.

@RReverser
Copy link
Member

If you're willing to create issue that doesn't reveal some actual bug, but is request for performance improvement, please add corresponding benchmarks so that we both don't waste time discussing theoretical questions and/or explaining something. Just "use something" without any ground or proof behind is counter-productive, so I'm closing this and similar issues for now.

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

2 participants