-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
refactor: add typed array support in DSV parser #9817
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
base: develop
Are you sure you want to change the base?
refactor: add typed array support in DSV parser #9817
Conversation
Coverage Report
The above coverage report was generated for the changes in this PR. |
|
cc @kgryte |
| setReadOnly( Parser.prototype, '_setField', function set( value, idx ) { | ||
| var buf = this._rowBuffer; | ||
|
|
||
| // FIXME: as buffer may be provided from userland, use `set` accessor and consider using `@stdlib/utils/push` to allow support of dynamically resizing fixed length buffers |
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.
This comment should not be removed, as the proposed changes only partially resolve what is described.
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.
It is also not clear whether we want to use utils/push here. The reason why this was not done originally was due to performance concerns. As such, I am not convinced that this PR should move forward.
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 mean the performance concern make sense it is low i mean should we go with caching the buffer type at initialization and using a fast path for arrays?
what u think on it ?
Restore the FIXME comment as requested by reviewer. The comment notes that while @stdlib/utils/push is now used to support TypedArrays, the set accessor for _rowBuffer still needs to be implemented.
Description
This pull request:
Fixes a crash in
@stdlib/utils/dsv/base/parsewhen a TypedArray is provided as therowBufferoption. The_setFieldmethod was callingbuf.push()which throws a TypeError since TypedArrays do not have apushmethod. added the fix suggested in the existing FIXME comment by using@stdlib/utils/push, which supports arrays, typed arrays, and array-like objects.Related Issues
This pull request has the following related issues:
Questions
No.
Checklist
AI Assistance
@stdlib-js/reviewers