Why fps loss when I press keys?

I’m confused about this question in my project.

So I try to find the reason…

In the end.

I create a new project to test.

And the FPS loss still exists.

This is a very simple environment.

I just press the key “F” and the FPS is lost from 180FPS to 130 FPS.

187594-1634539850746.gif

Anyone can tell me why?

And this is can solve?

Or maybe we can ignore this?

My version is unity 2019.4.4f1.

And here is the project :

I watched :

But the problem is not because OnGUI()

I try to print the log to test the FPS still lose.

About FPS code:

    void ExtraFPS()
    {
        deltaTime += (Time.deltaTime - deltaTime) * 0.1f;
        float fps = 1.0f / deltaTime;
        displayFPS = fps;
        //fpsText.text = Mathf.Ceil(fps).ToString();
    }

    void OnGUI()
    {
        if (isShowFps)
        {
            GUI.Label(new Rect(Screen.width - 200, 25, 400, 200), $"<color=green><size=40>FPS:{ displayFPS }</size></color> ");
        }
    }

Personally, I think you can ignore it unless it goes down to below 30 or if you are experiencing stutter/lagging in input.