Published app is much slower than Debug environment

My app runs substantially slower on the published environment (accessed through the website url) compared with the debug environment (launched from the IDE). Same commit, same code.

Opening different pages takes a few seconds on the published version of the app whereas it is nearly instant on the Debug environment launched from the IDE.

Interestingly enough, the app is also slow when the debug environment is launched in a new tab. So, to summarize:

  • Debug (run in split view): FAST
  • Debug (run maximised): FAST
  • Debug (run in new tab): SLOW
  • Published app: SLOW

The difference is dramatic (several times slower), even when loading pages cached through anvil extra’s hash routing or running functions that are entirely on the client side and do not make a server call.

What could this be due to, considering that it’s the same code? Are there other users experiencing the same thing? I would love to be able to achieve the debug speed on my production app. Thanks for any ideas or suggestions!

Other things to eliminate:

  • Is this effected by the browser you’re using?
  • What about if you use private browser?
    It could be one of your browser extensions is degrading performance.

It would be helpful to elaborate on what you mean by slow here.
And a minimal working example clone is always helpful.

There aren’t many differences between running debug mode in a new tab vs maximised, apart from one is running in an iframe, and the other is not.

1 Like

Hi @stucork, the weirdest thing happened today. All of a sudden my published app has the same lightning performance as debug mode. It’s never been this fast… Did the Anvil team change anything today?

Prior to today the app was seriously lagging regardless of the browser (chrome, firefox, edge) and regardless of private/incognito mode (the only extension I have is my password manager). I believe performance was slightly faster on Firefox (e.g., it took 2 secs to open certain forms as opposed to 3 secs). Also the app was faster on mobile browsers.

But today everything is instant…

I can share with you a clone privately if I encounter the issue again, but at the moment I cannot reproduce it.

1 Like

No changes that I can think of that would contribute to an improvement in performance when running in the IDE :man_shrugging:

I seem to have misdiagnosed the issue.

Upon testing more I discovered that the slowdown was caused by NordVPN’s ad blocking feature (which is weird because my app doesn’t have ads).

More specifically, any app instances that were launched when the Ad Blocker was active are slowed down, even if the Ad blocker is subsequently disabled. This is also true vice versa - any app instances that were launched when Ad blocker was disabled remain fast even if it is subsequently enabled.

For the instances that are slowed down, I notice a large effect on my CPU usage in the task manager. Switching forms via anvil extra’s hash-based navigation causes my CPU usage to increase from 7-10% to 30+% (the usage increase is from the browser, not NordVPN), whereas the same action performed on the non-slowed down instances has no noticeable effect on the CPU usage.

Another interesting point is that Debug instances launched in split/maximised view seem to be immune to the slowdown from NordVPN’s Ad blocker. Maybe because the app is running in an iFrame?

Now I wonder why NordVNP’s ad blocker slows down my app so much, whereas it doesn’t seem to have the same effect on other websites I use. I do not run any ads on my app, but I do load many images from an external CDN - perhaps there is some interaction there.

2 Likes