equinor / webviz

Mozilla Public License 2.0
6 stars 9 forks source link

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

Closed Anders2303 closed 2 months ago

Anders2303 commented 2 months ago

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

Anders2303 commented 2 months 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 2 months ago

Duplicate of #721 but with more info.

rubenthoms commented 2 months 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: