There are two things that usually help with this:
1. Restart the machine. I lot of people (particularly switchers) seem to be unaware that closing a program is not the same thing as quitting it, so it's still taking up resources. If this is you, learn to properly quit apps when you're done with them.
2. Check to see how much free space the hard drive has. If it's anything less than 25GB, that's likely to be your issue. Time for some cleanup, offloading or perhaps a larger hard drive.
3. Macs don't generally need optimizing, but if you've done the other two steps and that's still not sorting it, then you can try the following:
a. Using a CLONE program like Carbon Copy Cloner, clone your entire Mac hard drive onto an external of equal or greater capacity. Make sure the clone is bootable and complete by switching to it as your boot drive for a test.
b. Once that's done, boot from the clone and ZERO OUT the original hard drive using Disk Utility. Erase and zero out (1 pass is sufficient).
c. While still booted from the clone, now do a restore using CCC or migration assistant, it will put everything back on the "old" hard drive.
d. Finally boot from the original hard drive.