I had an iPhone 5s. It would crash after every gym battle. Or if I didn't restart the game it would crash when I started a new battle. The lag was horrible and even though I was dodging I would get him by the charge move.
Just got a new iphone 7 plus last week. Best investment I have made. It is a must if you battle gyms.
Just do it, get a new phone and do it today. The difference is night and day.