-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Typed arrays support #2388
Typed arrays support #2388
Changes from 3 commits
91b03ff
a25ff13
45c2f35
2d81bdc
bcf59d7
bc32981
2372629
909120e
5316c47
0aa0f5e
39ef5a9
36b4e25
40f93f7
d98dcc0
c0e2f73
09d37b6
a7ed2c2
b95e462
53ea0ec
98d2407
01a8443
c15722f
a2fb88b
f0395b5
9b83826
6dd2f69
306986d
d4cb0c4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -405,10 +405,15 @@ module.exports = function setConvert(ax, fullLayout) { | |
if(axLetter in trace) { | ||
arrayIn = trace[axLetter]; | ||
len = trace._length || arrayIn.length; | ||
arrayOut = new Array(len); | ||
|
||
for(i = 0; i < len; i++) { | ||
arrayOut[i] = ax.d2c(arrayIn[i], 0, cal); | ||
if(ax.type === 'linear' && Lib.isTypedArray(arrayIn) && arrayIn.subarray) { | ||
arrayOut = arrayIn.subarray(0, len); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. More info: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray Bypassing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typed arrays can't hold There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ... so yeah There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just for completeness while you're looking into edge cases, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To me surprise, Here are all the places we check equality with by the looks of it, these are all places that check I'll test out a few more cases this afternoon. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All right, I couldn't find an example of Replacing Note that these two lines in scattergl calc aren't necessary (as |
||
} else { | ||
arrayOut = new Array(len); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In cases like this where we know the length and we know we're dealing with numbers, would we benefit by using typed arrays internally? When they're supported of course - we'd need a helper to revert to For a later time regardless... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's an idea. Saving a few |
||
|
||
for(i = 0; i < len; i++) { | ||
arrayOut[i] = ax.d2c(arrayIn[i], 0, cal); | ||
} | ||
} | ||
} | ||
else { | ||
|
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.
perusing https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView - there's also
DataView
that passes but looks like it's a little too generic to be meaningful to us as an input. Should we be concerned about this?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.
improved in f0395b5