for me. lag is caused by 3 things:
1. too many items laying arround
solution: sell all your excess stock of food, drink, wheat, etc or stock it well.
2. beetles. once i had too much lag and as i was mining i had the luck to spot a beetle lair without relasing them. but there wasn't 50 of them.
In that lair i killed 20.000 beetles using my crossbow and i equiped all my non soldier gnomes with flintocks pistol and had 15 gnomes shooting beetles 24/7. it took 10 years to reduce the population to a non lag point, but i stil have to put my ranger there to kill some and keep them down.
3. and if you wonder why i dont just get rid of the beetles for good, its because the caves are all connected and there is always a beetle hiding somewhere, and if i try to open a path to the lair to send my meele guys and clear them out (wich actually isnt hard as beetles cant deal with steel) all the beetles hiding are going to atack my guys and all that pathfinding will crash the game. oh yeah thats cause 3, massive pathfinding, and im talking about 2000 beetles.
So, over all, sell the stuff you dont need and keep the beetle population controled