Closed ghost closed 1 year ago
Can you show an example code that can be simplified with this API (before/after)?
Can you show an example code that can be simplified with this API (before/after)?
Yes ( I will have to update the PR anyways as there are some old commits, appended)
In this case there are strings as well, but it would be simplified to
buffer.arrayOf(size, type)
Base: 100.00% // Head: 100.00% // No change to project coverage :thumbsup:
Coverage data is based on head (
768646a
) compared to base (b5216a9
). Patch coverage: 100.00% of modified lines in pull request are covered.:exclamation: Current head 768646a differs from pull request most recent head a4a6cc9. Consider uploading reports for the commit a4a6cc9 to get more accurate results
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
It slice
s copying the underlying AB now. Maybe I am just confused but for Uint8
seems faster than this.readBytes
at least in simple tests locally.
Maybe I am just confused but for Uint8 seems faster than this.readBytes at least in simple tests locally.
That makes sense to me, as readBytes
copies the bytes one by one. Feel free to update its implementation so it calls this new method.
Thanks. Sorry for the first snippet. I think I was impressed by using bind
for the first time :-(
Should we add Big Int arrays to the list as well @targos ? I have read them using loops and `readBigUint64 previously in some parsers.
Sure, I don't see why we shouldn't.
Sure, I don't see why we shouldn't.
I added the items from the prev discussion. Uses InstanceType
to give the user information about the returned TypedArray type.
May need another look to make sure everything is fine.
The "lint" action is failing.
The "lint" action is failing.
Yes, this seems because the node types need to be updated. I was just unsure whether I should do it, we can update several dependencies.
Ok, please try to update the dependencies. We can't merge this with red github actions.
What is solves
A user could type
buffer.arrayOf("int16", 8)
and get a typed array ofint16
s, moving also the pointer forward.This will simplify some lines like
new TypedArray(size)
and looping over it explicitly in the code.It may not be useful enough. If it is I will improve it.