You can google and hunt and search and read and find all sorts of ways to speed up your iMac, but I have here one small suggestion that may help you if you have a specific problem.
The problem arises when you invoke a dialog box that access the file system, perhaps by right clicking on a graphic on a web page and choosing to save it, or a save or save-as menu item in any piece of software. Then, the dialog box does not appear instantly, and instead you get the Spinning Beachball of Wait, and after several seconds, the dialog box finally appears.
This is a bug. It should not happen. But when it does happen, it appears based on my perusal of the Intertubes and some experimentation, it may be related to your computer being hooked to a network drive, or even a simple USB external drive. If you can just eject/disconnect all of that, you’ll have faster response.
That may not be an option, and if that is the case, you are screwed. Maybe.
There is a second kludge that may also work. Temporarily disconnect said drives. Your computer’s use of the file system will go to normal. Then, later, reconnect. Your computer may continue to be normal. Eventually, possibly later that day, the problem will return. This is obviously not a great solution but it may be good for some people who only occasionally use such drives.
This problem is annoying and I wish it would go away. If you have any other suggestions pleas add them to the comments!