Apple - Why is a 2.7 GHz iMac slower than a 1.8 GHz MacBook Air?
The examples you've used in your question can be explained by the use of the SSD in the MacBook Air.
In March 2014 I installed a hybrid drive (what Apple calls a 'Fusion' drive) into a late 2008 MacBook Pro. The results of doing this compared to the standard HDD that was installed previously were significant!
Now, remember this was just a hybrid drive NOT an SSD. My tests showed that:
- bootup time was 16 seconds faster
- login time was 6 seconds faster
- launching MS Word was 17 seconds faster
I then tested this against a mid-2011 iMac with a traditional 7200rpm drive and the MacBook Pro was faster! Remember again this was just a hybrid drive NOT an SSD in the MacBook Pro.
One thing you should notice on the iMac though is that the first time you launch an application after booting up it will take longer than subsequent launches (unless you've rebooted again).
So yes, the SSD will explain the difference in the examples you gave, but there will be other tasks that your iMac will perform faster because they rely more on processing power rather than disk read/write times.
Whether you should install an SSD is a matter for you. It'll improve speed generally, but how much will depend on what you use your iMac for.
[EDIT]
I found the full results of my testing for the hybrid drive in my late 2008 MacBook Pro. See the table below:
As you can see, the response times also improved by doing a reformat and clean install on the original HDD. However, since you've got a late 2015 iMac I don't imagine you've had enough time to weigh the system down with unnecessary software etc.
The point I guess I'm trying to make is that the answer to your question Is the HDD/SSD the main cause of this? is yes for the examples you gave, but if you have other real life examples that would be good for some context.
From what you've written it does not sound like the iMac's sluggishness is caused by the hard drive and I'd wait before swapping it out with a SSD (unless you were going to do that anyway).
It's true that a SSD can read/write faster than a traditional HDD and this should make a machine with the former installed more responsive and feel "zippier" than a comparably spec'd machine equipped with the latter.
However, given that your iMac has double the RAM, a better GPU and a 7200RPM HDD it should be fast and responsive and generally outperform the Air. It should definitely not be taking 20 seconds to launch an application or frequently stalling.
The "spinning beachball" suggests there could be background processes at work on your iMac that are hogging CPU cycles, causing the OS and other applications to struggle.
To check if this is the case Activity Monitor (located by default in
/Applications/Utilities) gives you an overview of the processes that are currently running and how much of the CPU's power they are tying up. This can help pinpoint which applications are using more than their fair share of processing power.
But if your iMac has been sluggish since you bought it, it might easier to back up your data, wipe the drive and do a clean install of the operating system. This could be quicker and less of a hassle than a lengthy troubleshooting process.