iMac running High Sierra is very slow — photoanalysisd can't be killed?
If you use iCloud  photos and sync with another device, you can turned off the photos sync on Mac. In case you go to turn it back on and it gives storage full error, do as suggested in download iCloud photo to mac OS X Yosemite 10.10.3 in second paragraph. 

However this will bring the problem back if you would want to use photos later. So best shot can be leaving it on overnight by disabling sleep in System Preferences and keeping it plugged in. This might give it enough time to complete the analysis.