They infinitely spawn (in 31.#), but you can certainly try to reduce the population as much as possible.
Note that, although they are technically infinite, once you clear out the initial invasion all you see are small migratory squads passing through hell that may not even attempt to attack your fortress (depends on whether they have pathing access, e.g. flying). If they do have pathing and are attempting to enter your fort, they tend to kill your framerate again, despite there being only 3-5 of them trying to path to a dwarf.
I cleared out the initial invasion in one of my forts via a very long 1 tile wide hallway of 10x upright steel spikes, linked to a lever in my meeting hall set on repeat. It was probably 30 or 50 tiles long and maybe longer, and even still sometimes a demon would almost get by it all, but none actually did. However, all of the demon types in that fort were killable (and I had reduced the number of demon types in worldgen specifically in the hope that I would get fewer unkillable types, although even the red diamond and salt demons were slaughtered by the spikes).
After clearing the invasion I had planned to seal all walls with clear glass, but I eventually got bored because of the sheer amount of work it would require (needed to wall and floor off all glowing pits in addition to any sides directly attached by the slade floors). I only ever used my military squads for protecting workers from migratory demons.