How to fix sluggish background callbacks

I’m attempting to implement a background callback process using the diskcache option. Using the sample code at Background Callbacks | Dash for Python Documentation | Plotly works just fine; however, the Example #1 code runs extremely sluggishly in my own app, sometimes taking 30+ seconds to complete (instead of the 2 second sleep in the example).

Working backwards to solve, I progressively commented out all of my code, piece by piece. There was no radical “aha!” when it was solved, but the response time slowly improved until it finally ran as normal. Of course my app was fully non-functional at that point.

Why should commenting out code cause the diskcache to run better? It seems like the background manager triggers a full background reload of everything (imports, etc.) whenever the callback is triggered?

Anyone experience the same behavior?