equinor / webviz

Mozilla Public License 2.0
6 stars 7 forks source link

Slowdown in `Intersection` module's Well-pick layer #724

Closed Anders2303 closed 3 weeks ago

Anders2303 commented 1 month ago

Adding a well-pick layer to the Intersection module causes significant frame-drops

Anders2303 commented 1 month ago

For the settings, could it be this line from wellpicksLayer.tsc?

    const [newSettings, setNewSettings] = React.useState<Partial<WellpicksLayerSettings>>({});
    // ...
    React.useEffect(
        function propagateSettingsChange() {
            props.layer.maybeUpdateSettings(newSettings);
            props.layer.maybeRefetchData();
            setNewSettings({});
        },
        [newSettings, props.layer]
    );

Wouldnt this effect cause itself to always re-trigger, since it both depends on newSettings, and sets it to a new object every time?

rubenthoms commented 1 month ago

Duplicate of #721 but with more info.

rubenthoms commented 1 month ago

For the settings, could it be this line from wellpicksLayer.tsc?

    const [newSettings, setNewSettings] = React.useState<Partial<WellpicksLayerSettings>>({});
    // ...
    React.useEffect(
        function propagateSettingsChange() {
            props.layer.maybeUpdateSettings(newSettings);
            props.layer.maybeRefetchData();
            setNewSettings({});
        },
        [newSettings, props.layer]
    );

Wouldnt this effect cause itself to always re-trigger, since it both depends on newSettings, and sets it to a new object every time?

Looks like a plausible candidate :+1: