You have a lot of unit group leaks. These can eventually cause lag.
From what I could tell he had some, but not a lot. Those were finite in number since they were mostly initialization or once off events like player leaves.
Never use integer A / B. Create your own integer in the variable editor and use that integer in place of integer A / B.
Not his problem. Those do not leak nor do they cause poor performance for most purposes.
Anything you use twice or more should be stored in a variable and the variable should be used. Example: Set tempUnit = (Picked unit). Then use tempUnit in place of picked unit.
That is correct however makes only really a difference in high performance code, of which he has none of.
Use triggering unit instead of trained unit / entering unit / dying unit / sold unit / and others.
Makes only a difference in performance code. He has none of such code.
You have location leaks which can cause lag.
Currently this is what I am thinking is the cause of the poor performance. Every spawn and every way point leaks a location which will add up over time.
Without a replay which ends by performing badly I cannot rule out other factors such as excessive visual effects etc.
You use a gold giving trigger that is inefficient. You can use mine. It is on this site and is more efficient and allows a couple of different options on how to give gold. It will also decrease your map size by a little bit. My system is in jass but everything you need to edit / change is all in GUI so it is easy to use. Give Gold and / or Lumber System v 1.0.1.4 There are 2 systems one for giving gold and one for giving lumber in that link. You can use one or both if you feel like it.
As good as it is, that is not his problem. It is not like he has any performance critical code in the first place let alone such code that deals with gold.
If you have a lot of location leaks then the game typically lags when your screen is focused on the general area of the location leak.
Incorrect? Location leaks do not alter performance at all by themselves. Instead they will make location based operations more computationally expensive (especially ones that return location objects).
You might be confused with special effect leaks. Although the model is not visible (due to animations) it will still be animated and rendered when in view. With enough special effect leaks viewing an area might require several frames of GPU time to generate a single display frame.
Items also suffer a similar graphic leak if they are killed instead of removed. Since items lack decay and then removal, all killed items persist until end of session or removal. His map does not suffer from this item leak since he removes all his items. His map might suffer from internal widget leakage however but that is hard to prove.
His sell trigger leaks a special effect. This should be minor for most TDs (as selling is bad) however if selling occurs a lot it would explain his performance problem.
I do not think locations have to even be valid. People used to use them as data structures by direct typecasting integers into them. Locations also do nothing with the camera so I doubt viewing them can possibly lower performance.