Instanced foliage is causing massive performance drop when changing visibility of ordinary static meshes

In the source code Engine\Source\Runtime\Renderer\Private\GPUScene.cpp for 4.26/4.27/UE5.0, there are CVar functions
r.GPUScene.UploadEveryFrame=0 // that means EveryFrame is uploaded

r.GPUScene.ValidatePrimitiveBuffer = 0 // that means not validating GPU buffer, but if you do set this performance does not exist, maybe it’s for RTX debug?

r.GPUScene.MaxPooledUploadBufferSize= 256000 //Maximum size of GPU Scene upload buffer size to pool
The code for UE 5 is here same as 4.27

I am not anywhere near an expert in UE5 just an indie coder and VS2022 fan!
So I just know where to find the code.
The code changes considerably
the real problem is that the code is checked in GPU, presumably for RTX?.
Rather worrying is for some reason the logging has been commented out

If you uncommented this you could at least see if this was the code causing the problem .

I have no way of checking as I am not a graphics designer and don’t build my own graphics projects just test others

Can I also suggest you look at
ShadowDepths in GPU visualizer hurting performance

The YouTube video is really interesting by

sg.shadowquality 0 where value is between 1 and 4

I know I get a 25% increase and the example is for UE4, but this works with UE5 as well WITH Nanite and Lumen and it’s really sg.shadowquality that’s the problem. When you pull out from the temple you get 78FPS on my under minimum spec GeForce GTX 1050
This is Sun Temple running twice FPS with StatGroup_GPU

All that’s needed is to learn LumenSceneLighting

Maybe this affects your other question
Foliage light problem depending on the orientation of the camera - Unreal Engine 5 Early Access

If you want to build UE5 code please see the post on how to
Visual Studio 2022 builds and runs UE5.0