Fast way to share data between callbacks

I have some intense data manipulation and I thought it would be better to store this content in a hidden div and spread it to the other callbacks. The problem is that converting from JSON to dataframe (and I need to do it many times once my aplication shows tables, pie charts, bar charts and etc) takes real long, and at the end I don’t know what is less expensive: repeting my super long process all over again or keep using the hidden divs (I have many of those, about 5). Has anyone tryed any workaround for this situation? My dash takes about 20 seconds to update when I filter it with dash core components.

1 Like

Are you sure that it is this conversion step and not the transport of the JSON to the browser?

There are two alternatives to consider:
1 - Instead of storing the data in the div (which requires network transport), you could also try saving it on the disk. Here is an example: Capture window/tab closing event - #2 by chriddyp
2. If you are saving it to the disk, perhaps instead of encoding as JSON, encoding as feather would be faster. See Apache Arrow and Dash - Community Thread for a discussion

3 Likes

@chriddyp Every example I’ve seen and even the Dash documentation on performance don’t make clear how to save data to the disk when you have a callback. In my current configuration, the user selects a category or a month and it fires the callback that sends a heavy data to a hidden div. Is it possible to keep the callback inputs and send the output to the disk? I don’t think I saw nothing like that… This is my main doubt.

1 Like

@abcorep - I linked an example that saves it to the disk in the comment above. Here it is again:

1 Like