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

Embedding with buffers #1282

Closed
maartenbreddels opened this issue Apr 13, 2017 · 5 comments
Closed

Embedding with buffers #1282

maartenbreddels opened this issue Apr 13, 2017 · 5 comments
Labels
resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Milestone

Comments

@maartenbreddels
Copy link
Member

@jasongrout @SylvainCorlay
Since buffers can be part of the state, we need to think how they will be stored in the json for embedding.
For the js and the py side we can simply use the same code we use to pluck out and insert the buffers, it's only a matter of how to store it in the json state.
I suggest sth like this (looking at the schema), by example:

...
state: {
  description: ...
  buffers:  [
   [['MODEL...', 'bla', 1], {'encoding: ['base64'], data: 'AF... 33'}],
   [['MODEL...., 'lala', 'x'], {'encoding: [], url: 'MODEL_123_lala_x.dat'}]
 ]
}

so it's a list with [path, data object] pairs, where data object specified how it is encoded (as a list, so it can be first zipped, then base64'ed). Or it could be a url, this would allow to load binary files efficiently, since a webserver can zip it on the fly. The only issue would be, can you from a ajax request get a Buffer object?

@SylvainCorlay
Copy link
Member

SylvainCorlay commented Apr 13, 2017

I would say go with base64 encoding of the raw buffer. The memory overhead is only 33%.

The extra complexity of a companion binary datafile does not seem to be worth the effort.

@SylvainCorlay
Copy link
Member

There was a very strong case for real binary in the wire format compare to base64 because we could skip the serialization stage and go faster, but in the case of the serialized widget state, it is only a one-off.

@maartenbreddels
Copy link
Member Author

I'm more worried about the performance, a 100mb base64 json will be an performance issue (it will crash the browser), a 100mb raw file that will be loaded similar as now over the websocket will be quite fast.

@maartenbreddels
Copy link
Member Author

We could leave the external files to 7.1, but for ipyvolume it would be useful. But lets do base64 first, but I'd be explicit with the encoding, and put it in.

@jasongrout
Copy link
Member

jasongrout commented Apr 14, 2017

I'm more worried about the performance, a 100mb base64 json will be an performance issue (it will crash the browser), a 100mb raw file that will be loaded similar as now over the websocket will be quite fast.

Right now copying and pasting 100mb of data from a text box would be prohibitive anyway (thinking of how we currently do the 'embed this widget' bit). I think this base64 solution really only works for much smaller data sets (e.g., the data in a simple bqplot chart).

It would be good to iterate on how to do larger data sets. You have some interesting ideas about how to support that at the widget protocol layer. I was thinking we'd do it at the widget serialization layer.

@jasongrout jasongrout added this to the 7.0 milestone Apr 18, 2017
jasongrout added a commit to jasongrout/ipywidgets that referenced this issue Apr 19, 2017
jasongrout added a commit to jasongrout/ipywidgets that referenced this issue Apr 19, 2017
@github-actions github-actions bot added the resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label Feb 13, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Projects
None yet
Development

No branches or pull requests

3 participants