Get help from the marimo community

Updated 4 days ago

Altair performance questions

At a glance

A community member reports performance differences between Jupyter and Marimo when using Altair for dynamic plotting with slider filters on large datasets. In Jupyter, using alt.data_transformers.enable("vegafusion") and alt.renderers.enable("jupyter", offline=True) provides fast updates (less than 1 second), while Marimo's implementation using Polars dataframe filtering is slower (2-5 seconds).

Through the discussion, other community members suggest that VegaFusion can be used in Marimo as well, and provide documentation links about performance optimization using Data Transformers. While one member demonstrates that JupyterChart can be rendered in Marimo with a small dataset, the original poster notes that performance differences become more noticeable with heavier datasets.

The discussion reveals that marimo_csv doesn't work like VegaFusion's data transformer, which evaluates data transformations interactively without transferring the full dataset to the browser. A community member indicates they will look into bridging capabilities with the Jupyter data transformer to potentially improve performance.

Useful resources
Hi team, thanks for your work on this package. Apologies for the dumb question, I have been using large datasets and used altair for dynamic plotting with slider filters.
Using on jupyter:
alt.data_transformers.enable("vegafusion")
alt.renderers.enable("jupyter", offline=True), this is very fast (less than 1 sec for the update).
I tried to achieve the same filtering using marimo sliders directly on my polars dataframe and then plotting, this works but it is slower as obviously polars needs to do the filtering and run 2 cells (2-5 seconds).
For this use case, the JupyterChart (jupyter renderer) is faster, is there any plan to have it supported in marimo ? (Other renderers being too slow for large datasets)
M
A
t
22 comments
can you share an example with us? you can use alt.data_transformers.enable("vegafusion") in marimo as well
Let me send something tomorrow
with a heavier dataset, the difference becomes noticeable
I'm basically asking about support for JupyterChart at some point
Thank you for looking into this
I cant see any slowness - it takes a 83ms for your example to re-render for me. (although its not a large dataset). happy to debug an example if you can send one with a larger dataset.

also, I was able to render a JupyterChart as it was shown in the altair docs:

Plain Text
import pandas as pd
source = pd.DataFrame({
    'a': ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I'],
    'b': [28, 55, 43, 91, 81, 53, 19, 87, 52]
})
chart = alt.Chart(source).mark_bar().encode(
    x='a',
    y='b'
)

jchart = alt.JupyterChart(chart)
jchart
We also have a doc about better performance utilizing Data Transformers
https://docs.marimo.io/api/plotting.html#performance-and-data-transformers
Thank you for looking into this! I'll have another look over the coming days πŸ™‚
"The JupyterChart widget and the "jupyter" renderer are designed to work with the VegaFusion data transformer to evaluate data transformations interactively in response to selection events. This avoids the need to transfer the full dataset to the browser, and so supports interactive exploration of aggregated datasets on the order of millions of rows." I'm curious, is marimo_csv doing the same thing under the hood?
are you able to run the notebook with either renderers?
jupyter renderer (works instantly in jupyter FYI) gets me an output limit
marimo_csv plot is empty for some reason
I still need to get you an example of a heavy dataset where the re-rendering time is long
marimo_csv won't work like vegafusion, but you can also just use vegafusion which should be performant
I can look at the jupyter data_transformer as well to see if we can bridge some capabailities
That would be nice ! πŸ™‚ thank you for your help!
Curious if you ever got this working?
I do most of the processing/filtering in polars now and use the marimo_csv renderer
Add a reply
Sign up and join the conversation on Discord