How many applications do you run simultaneously in the background while working in another application?
If you have a long list of user login/startup items that launch at startup/login, you need to reduce the amount of these to around 6 or so items or less, if possible.
Do you have any unnecessary antivirus installed on your iMac?
Have you updated all of your installed software and updated all connected third party device software and drivers?
Have you updated all of the various web browser plugins you that have installed within your web browser?
Do you use Google apps, like Chrome and Drive?
Ditch ALL Googlewares. They are ALL a serious resource hog on the OS X system.
https://support.google.com/chrome/answer/95319?hl=en
https://support.google.com/drive/answer/2375081?hl=en
If you do not like Apple's Safari web browser, download, install and try Mozilla FireFox, instead.
The current, up-to-date version of FireFox is fully compatible with OS X and is regularly updated by the great developers of the Mozilla group.
I have, also, stopped using the Google search engine, regularly and use DuckDuckGo as my default search engine.