Editor - slowdown when calling function from slider?

In my custom editor I call a complex function on the target script, ReCalc(), which modifies large meshes, which on my machine takes around 100ms.
If I invoke this function via a button, a key-press, or some other ‘single’ method, it runs as expected. Calling it sequentially multiple times, gives the same expected result, i.e. it can execute about 10 times per second. (In this particular case, you can see the mesh update 10fps)

However, if I’m modifying a parameter of that function via an editor slider, which necessarily means calling ReCalc() as the slider is changed, you can clearly see a big slowdown, and it only manages to do 1 or 2 updates per second instead of 10.
Running a timer on the function still shows the expected 100ms, so that doesn’t help.
It’s like the constant flow of commands from the slider is interupting itself, and causing massive lag.

I’ve noticed this is a consistent problem when calling heavy-duty processing from a slider, this is just one example where it’s very easy to see .

Is there an established practice for dealing with this, as I guess it must be quite a common scenario?

Thanks.

One option I could think of is to check to see if the method is running or not. If it is not running then only call that method. It can be achieved using a bool that you can check to see if method is running or not.

Something like:

Custom Editor Script:

float scale;
MeshHandler mh;

void OnEnable()
{
    mh = (MeshHandler) target;
}

void OnInspectorGUI()
{
    scale = EditorGUILayout.Slider(scale,1, 100);
    if(!mh.isRunningReCalc)
    {
        mh.ReCalc();
    }
}

MeshHandler Script:

bool isRunningReCalc = false;

void ReCalc()
{
    isRunningReCalc = true;
    // Perform your task here
    isRunningReCalc = false;
}

You can also check to see if the slider value has changed or not, so as to call this method only if the slider value has changed.