vl-convert icon indicating copy to clipboard operation
vl-convert copied to clipboard

Allow to set heap limit for v8

Open nbars opened this issue 10 months ago • 3 comments

Hey,

Thanks for this great project! I am running into out-of-memory errors when plotting complex plots via Altair, and I guess that should be fixable by bumping the heap limit of the v8 engine. Would it be sufficient to add something like this

let options = WorkerOptions {
    extensions: vec![
        vl_convert_text_runtime::init_ops(),
        vl_convert_converter_runtime::init_ops(),
    ],
    module_loader: module_loader.clone(),
    ..Default::default(),
    BootstrapOptions {
        args: fillFromEvnVarOrUseDefaults(), // set, e.g., --max-old-space-size=131072,--max-heap-size=131072
         ..Default::default(),
    }
};

here

https://github.com/vega/vl-convert/blob/e941288af64025b60a13493b3d7ad70da980f698/vl-convert-rs/src/converter.rs#L570-L577

Or is there a better place to start?

Best, Nils

nbars avatar Apr 05 '24 12:04 nbars

Hi @nbars, thanks for the kind words! Making the v8 heap configurable would be great. I haven't looked into this, so you probably know more about this than I do right now. Do you want to try making a PR?

As an aside, if your charts include aggregations then it may help to enable the VegaFusion data transformer. When this is enabled, data transformations (like filtering and aggregation) will be applied in Python before the data is sent to the vl-convert. For charts without aggregations, it will also remove unused columns which can also reduce memory usage.

But even if this helps, it would still be great to have the v8 configuration option exposed.

jonmmease avatar Apr 05 '24 12:04 jonmmease

Hi @jonmmease, thanks for the swift response. Using VegaFusion works like a charm! I am happy to make a PR. Is it possible to assign me to the issue so that it is added to my "GitHub todo list"?

nbars avatar Apr 05 '24 12:04 nbars

Glad that worked! Yes, I just assigned to you. Thanks!

jonmmease avatar Apr 05 '24 13:04 jonmmease