Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add support for encoding TypedArrays as primitive objects for serialization #2911
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
Add support for encoding TypedArrays as primitive objects for serialization #2911
Changes from 1 commit
636e644
5030d3a
dfd44d5
ec21714
8de7b5a
5107c97
5cdb828
1ec957a
a7c3814
2b9bda9
669e8be
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Ideally, the
{dtype: '', data: ''}
-> typed array conversion should happen during thecalc
step. More precisely somewhere here:plotly.js/src/plots/polar/set_convert.js
Lines 103 to 136 in 24a0f91
Depending on how slow this conversion can be, moving it to the calc step will help ensure faster interactions (note that the
calc
is skipped on e.g. zoom and pan).This might be a fairly big job though, you'll have to replace all the
isArrayOrTypedArray
calls upstream of the calc step with something likeisArrayOrTypedArrayOrIsPrimitiveTypedArrayRepr
(or something less verbose 😄 ).So I guess, we should first benchmark
primitiveTypedArrayReprToTypedArray
what kind of potential perf gain we could get.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.
@etpinard Maybe I'm misunderstanding something. As it is now, I thought these conversions would be happening in the
supplyDefaults
logic for the various traces. Does that logic run on events like zoom/pan?Either way, I'll get some performance numbers for
primitiveTypedArrayReprToTypedArray
. I was hoping I wouldn't need to retrace all of the steps you went through to add the originalTypedArray
support!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 think that all of them, except for
Uint8ClampedArray
:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays#Typed_array_views
Might as well add it here for completeness.
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.
Added in 5030d3a
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'm curious. Have you benchmarked this routine here for bas64 string corresponding to 1e4, 1e5, and 1e6 pts?
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.
Not sure about using
"data"
,"data"
has a pretty important meaning already for plotly.js. I'd vote forvalues
.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.
or maybe just
"v"
as calling a base64 string a set of values sounds wrong.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 renamed
data
tovalue
(singular) in 5030d3a. Does that work for you?v
felt too short 🙂