How can I get a modded minecraft server running smoothly on a personal computer? [closed]

Well, I eventually ended up finding a solution. Turns out, since most Minecraft mods are made by hobbyists and not experienced coders, there are some bad programming habits that are common to them, and one of those appears to be calling explicit garbage collection, way too frequently, eating massive amounts of CPU time.

As such, adding the -XX:+DisableExplicitGC flag to the java arguments helps a lot, and then various other tweaks to the automatic garbage collector, found on this blog post from someone who knows much more about what they're doing than I do, dropped CPU usage from constantly 60% to as low as 1% when no one's online, and tick time is now fairly constant at 2~10 milliseconds instead of idling at 0.3 ms and spiking to ~400 ms.

For the purpose of not making this effectively a link-only answer, below are the JVM arguments the above blog post proposes using for any minecraft version between 1.8 and 1.15:

java -Xms10G -Xmx10G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:-OmitStackTraceInFastThrow -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=8 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=true -Daikars.new.flags=true -jar serverjargoeshere.jar

The source says that you should feel free to change the -Xmx and -Xms arguments to the amount of memory you wish to use, and everything should work fine. Not mentioned in the source is that these flags appear to help client performance as well as server performance, though perhaps not to the same extreme degree.