vega / vl-convert

Utilities for converting Vega-Lite specs from the command line and Python
BSD 3-Clause "New" or "Revised" License
96 stars 12 forks source link

Update resvg to 0.34 for improved performance #65

Closed jonmmease closed 1 year ago

jonmmease commented 1 year ago

Updates resvg from 0.32 to 0.34, which brings a noticeable performance improvement for charts with lots of marks (e.g. large scatterpots). The improvement is likely due to the new rendering algorithm introduced in resvg 0.33.

Example

Here is an example of a scatter plot with 100k points:

import altair as alt
import pandas as pd
from vega_datasets import data

source = data.cars()

source = pd.concat([source] * 250, axis=0).reset_index()
len(source)
101500
chart = alt.Chart(source).mark_circle(size=60).encode(
    x='Horsepower',
    y='Miles_per_Gallon',
    color='Origin',
)

Before

%timeit chart.save("images/scatter.png")
19.6 s ± 34.9 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

After

%timeit chart.save("images/scatter.png")
4.07 s ± 43.5 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

More than 4x faster in this case. Thanks for your work on this @RazrFalcon!

RazrFalcon commented 1 year ago

You're welcome!