Which way is better for performance?

Hello guys.
Im creating a Tower Defense game.

It is better to store money variable in GameManager(singleton) and addMoney through it like that

Enemy.CS

public void Die()
{
	GameManager.GM.addMoney(5);
}

or in non static script and do it like

Enemy.CS

public Player player;

void Start()
{
player = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>();
}

public void Die()
{
     player.addMoney(5);
}

Which way is faster? Or maybe there is no difference?
There will be a lot of enemies in my game so addMoney will be called very often.
Also i will use object pooling for better performance.

No difference. Actually, there is a unsignificant difference. Unsignificant coz you won’t see it as it is so small.

Using static saves the call for virt that happens at low level. That virt method is meant to return null if the instance is null, so with static, no instance so no need to check.

On the other hand you are one level higher:

GameManager.GM.addMoney(5);

see you have two dots so two dereferentiation as opposed to 1 in the other case. But the instance case (GetComponent) also adds a hidden parameter to the stack (the this reference). on the method call…pfiiiouuu this is getting annoying.

You could benchmark to see which is faster and you would realize that the gain was not worth the waste of time.

Trust me on that, move on, there is nothing to gain here.