I've finally figured it out. The solution was... Rather odd. TL;DR: Run it under strace
. Read on for a more detailed explanation.
I came upon it when I decided to run IntelliJ under strace
to see what files it was opening to determine whether or not it was a filesystem bottleneck.
This gave me some very strange results: strace
was spewing out a near-constant stream of segfaults. Not only that, but IntelliJ was running just fine, not taking forever to index.
After consulting with a friend, I learned that on Arch Linux, systemd logs a dump of a process's memory every time a segfault occurs, except when a debugger is attached. strace
is considered a debugger. Arch was thrashing my disks when it kept logging memory dumps due to all the segfaults, hence why the indexing was taking so long, because it was fighting for disk I/O.
My solution for now is to simply run IntelliJ under strace
. I will, however, be looking into the issue further, as I don't think java
should be segfaulting that much.