What is going on behind public variables that I assign in editor?

Which one is good on performance?

public Rigidbody rb;
public GameObject player;
//assign in the editor


Rigidbody rb;
GameObject player;
string playertag = "Player";
       player = GameObject.FindGameObjectWithTag(playertag);
       rb = player.GetComponent<Rigidbody>();

Assigning a variable in the inspector is much better than using GetComponent (avoid using GetComponent if you don’t need it, it’s a fairly costly method of getting components)