Compiling with clang in the terminal is extremely slow after seeing a message that my disk is almost full. How to restore performance? I removed files so I now have 18.7GB storage free after receiving the finder message that my storage is almost full.

Still, compiling is extremely slow. I’m wondering if there some setting that I missed.

How can I remedy this?
If you are on a spinning hard disk and you remove a large amount of files, you might have sub-optimal allocation of some files. If you have an SSD, you’ll need to profile the build process to determine the actual bottleneck.

Just to confirm, the df -g command lists 18.7 GB free for the OS volume? Assuming yes, you’ve missed no settings like cleaning up local snapshots in time machine or emptying the trash.



For the HDD situation, you can test that by shutting down the Mac after removing the source files or copying them to another drive.

After the restart, you might run for a day (set the Mac to never sleep) and the hot file optimization will start to move files that aren't accessed often off of the fastest portion of the hard drive.

Then - move your source code back and try a compile. At that point if you are still slow, you'll need to get into specifics - use the time command to time the compiles and then profile the system with vm_stat 5 or similar like Activity Monitor to see if you are constrained by RAM or by CPU or by IO. iostat also will be very helpful for measuring the iops and read/write aggregate transfer rates so you know how your storage is being accessed moment by moment while clang does it’s work.

The above steps on my machine show that io and storage has a very low impact on the compiler and instead CPU and threading the build would be how to speed it up but my code base is probably far different than yours.