Coalesce events/Minimize wakeups
Currently (with git) running a few dozen torrents causes high CPU usage due to events/s as per powertop.
It's really bad, powertop shows: 295.4 ms/s 17975.6 Process /usr/local/bin/xd that's ~20,000 wakeups a second, meaning almost all CPU usage is overhead.
currently each torrent and peer connection has several go routines that use busy loops, probably better to restructure that. the whole xd/lib/bittorrent/swarm package needs to be broken up into a many sub packages. i have neglected this refactor.
can you tell me if https://github.com/majestrate/XD/commit/4ad8382468e71d4747912939b80869547aa0d745 is better or worse?