How to increase / decrease a priority of a macOS process?
Possible duplicate to this superuser question.

However, you may want to read this article.

Here is the gist you really need to do:


Make sure that no malware is running / slowing down your mac.
In Terminal, identify running processes: ps -ef
Make sure to close any unneeded resource intensive applications and processes, e.g. check the CPU, Memory, Disk usage at least with Activity Monitor.
nice (if just launching) or renice (if already running) the desired app, e.g. 'photoanalysisd' to maximum. In Terminal: renice -n "-20" -p (put PID of 'photoanalysisd' here)
renice everything else you still need to be running to minimum. In Terminal: renice -n "20" -p (put PID of process you need to de-prioritize here)


NOTE that the:


Max (Requested) Priority = -20 (Minimal value)
Min (Requested) Priority = +20 (Maximal value)


that may be a bit confusing. 



If all of above fails to produce enough improvement, the following upgrades may be a cost effective solution, if available for your mac:

1) Switch your HDD or slower SSD to an SSD with the the maximum Link Speed that your mac system supports. (Prior to this, if possible, add a fastest available interface to your system.) The current numbers can be viewed in the System Information app's Hardware > PCI | SATA/SATA Express tabs, as well as other tabs relevant interfaces your system actually has installed. The supported speeds may be available on your system's Apple support page, although they may be lower than the factual, since Apple may not update support pages when, for example, a firmware update adds support for a faster interface that was not supported by the original.

2) Max out your RAM. Again, the supported RAM amount may be available on your system's Apple System's support page, although it may be lower than the factual, since Apple is known to me to not update these when for example a larger single RAM unit becomes available than at inception. For example a 2010 Mac Mini supports 16 GB of RAM (2 x 8 GB), while according to the Apple support page it only supports 8 GB total. I would suggest you research this further on user forums for your system.

Apple systems, other than notebooks, tend to be sold with a big upgrade-ability. So if you max out the above two factors, you may increase the responsiveness of your system from crawl to excellent easily. (e.g.: RAM 2 GB -> 16 GB + SATA HDD -> SATA 2 SSD = 2nd life) 

(For the few Apple systems that allow GPU upgrades, proceed similar to item 1) above)