Rendering of 2D Map very slow, what am I doing wrong?

I have a map controller script (c#),
Generation of the map in setup():

for (int i = 0; i < height; i++) {
			for (int j = 0; j < width; j++) {
				GameObject go = (GameObject)Instantiate (prefab);
				go.transform.position = new Vector2 (j, i);
				go.isStatic = true;
				go.SetActive (false);
				gos.Add (go);
			}
		}

Calculating if I should activate a tile or not in update():

foreach (GameObject go in gos) {
			if (go.transform.position.x > left-treshold && go.transform.position.x < right+treshold && go.transform.position.y < top+treshold && go.transform.position.y > bottom-treshold) {
				//Debug.Log ("I am visible!");
				if(!go.activeSelf){go.SetActive (true);}

			} else {
				if(go.activeSelf){go.SetActive (false);}
				//Debug.Log ("I am NOT visible!");
			}
		}

With a width and height of 200, I only get ~30fps. What can I do to optimize my program?
I’m very new to c# and I’d like to learn as much as possible. Thanks :slight_smile:

@theeisbaer You created 40,000 game objects which probably will be a really huge amount of time taken for ‘culling’ and figuring out what’s visible etc. Every one of those transforms (for those that are active) have to be calculated in terms of a rotation matrix. There’s a lot of calculations going on there. I imagine Unity is trying to optimize what it displays based on which tiles are visible so when you make changes it has to do a lot of recalculations?