Pretty much any SSD is going to be much faster than an HDD.
You're looking at much faster read speeds on an SSD.
A typical 7200 RPM HDD will deliver a read/write speed of 80-160MB/s. On the other hand, a typical SSD will deliver read/write speed of between 200 MB/s to 550 MB/s.
But, fret not! You can add an SSD to your iMac.
Here's a link from the Apple's website. Here. I'm sure you can find a DIY guide there somewhere. Or check with your local Apple Authorized Service Provider.
But answering your question, if your 2014 has an SSD and your 2017 has a HDD, the one with the SSD is going to be faster, regardless of the year.