More RAM may help with the speed.
I have the 27 inch, late 2009 iMac with the full 16 GBs of RAM and OS X El Cap runs pretty well on my iMac.
How much RAM is installed in your iMac.
Your iMac is capable of installing up to 16 GBs of RAM.
That may help with your overall performance on El Capitán AND High Sierra, if you choose to upgrade.
Before embarking on a major OS upgrade, it would be wise, advisable and very prudent if you have a good, working backup of your current system to an external connected and Mac formatted Flash drive OR externally connected USB, Thunderbolt or FireWire 800, Mac formatted hard drive. Then, use either OS X Time Machine app to backup your entire system to the external drive OR purchase, install and use a data cloning app, like Bombich Software CarbonCopyCloner or Shirt Pocket Software SuperDuper, to make an exact and bootable copy (clone) of your entire Mac's internal hard drive. This step is really needed in case something goes wrong with the install of the new OS or you simply do not like the new OS, you have a very easy way/procedure to return your Mac to its former working state.