each time you kill haunter, you lower the gym by 2000 xp. You need not chose attacking team, just take what is suggested - you are super fast.
Your opponent has to chose his team of six prestigers every for every run.
In theory, you should be able to stop this building process, and you get lots of xp for doing so.