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

[Question] How to update data and layout one time for both ? #11

Open
touchft opened this issue Apr 6, 2021 · 9 comments
Open

[Question] How to update data and layout one time for both ? #11

touchft opened this issue Apr 6, 2021 · 9 comments

Comments

@touchft
Copy link

touchft commented Apr 6, 2021

I find that separate update of data and layout will decrease the performance through the method plot(:data, layout=:layout).

Is that possible to update data and layout one time for both? (The update behavior is similar to Plotly.update in Plotly.js)

@touchft touchft changed the title [Question] How to update data and layout one for all ? [Question] How to update data and layout one time for both ? Apr 6, 2021
@essenciary
Copy link
Member

Not sure I understand. plot(...) renders the web elements as HTML. The state is synchronized via data payloads over websockets/ajax when the values actually change, when you you modify data or layout (which are individual operations).

@touchft
Copy link
Author

touchft commented Apr 8, 2021

Sorry. I have to make myself more clear.
Supposing I have 100 trace and layout to plot on web, all trace and layout change every second. If use current method as <plotly :data="data" :layout="layout" ></plotly>, the update of plot on web will be 200 times per second for some point of view. If there will be a method like <plotly :update="update"></plotly>, the realization of update plot on web will be 100 times per second, which behaves the way as Plotly.update do in Plotly.js.

Note: The number 100 or 200 are used to represent the amount of data. They are not strictly correlated.

@hhaensel
Copy link
Member

Very interesting question. It is not straight forward. I think, we could use the js function $withoutWatchers and pass a regex that matches all listeners. That way one could update a field silently.
This could be done either via a javascript routine (@essenciary just implemented this in Genie) or we might come up with an internal solution by supplying not payload but silentpayload as a key.
We already thought about a syntax that would allow for sending only single array elements. That could be done at the same time...

@essenciary
Copy link
Member

Before adding more complexity to the code (and more code to maintain) I would like to actually validate the initial assumption: that separate updates decrease performance. Are there any metrics to back that?

Without conclusive metrics I'm not sure that's the case (although it's possible). But the size of the data payload it's the same for both approaches and I expect that an equal amount of UI re-paints will occur as updates are propagated on the front. So I would like some info backing that assumption, showing off a clear performance benefit.

@hhaensel
Copy link
Member

Good point, I'll try to checkt it

@essenciary
Copy link
Member

The direct comparison with Plotly.js is not accurate as that is a one tier implementation, while ours is 3-tiered: Julia, Vue, and Plotly. There is state in Julia, state in Vue, and state in Plotly. And these changes are propagated across the 3 tiers. For example, how will the updates be performed by Vue as the tier between Julia and Plotly?

@hhaensel
Copy link
Member

I'd compare the two update methods. One updating layout and data sequentially with listeners and one updating data data without listeners and data with listeners as this is my peoposed work around. But I would first do it manually at the browser console...

@essenciary
Copy link
Member

What about having a method which takes a new type of object which has fields for both data and layout?

@hhaensel
Copy link
Member

That would be pretty much like the Plot struct in PlotlyBase ...
But with the current setup we would always send both data and layout over the wire

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants