Does these codes slow down my game?

Hello

i have 2 questions regarding fps or how fast/slow the code is.

1-Does these codes slow down my game (what if i used them 100times or 1000times per click on a button)

//First Code:
GameObject NewCreatedItem = (GameObject)Instantiate(itemPrefab);

//Second Code:
SomeClass accItsScript = NewCreatedItem.GetComponent<SomeClass>();

2-How can i know if this code is slow or fast?

  1. Every line of code that gets executed gives the CPU instructions to perform. Every CPU can only perform a certain number of instructions per second. So, yes, those lines of code will slow your game down just like any other.

  2. Use the profiler - Unity - Manual: Profiler overview