Drives: SSD Tuning, TRIM and Hard Drive Defragmentation
The Drives page under Hardware tunes storage. It treats solid state drives and mechanical hard drives completely differently, because what helps one harms the other.
If you have an SSD
SSD Optimize enables aggressive write caching and disables legacy file indexing to speed up reads.
TRIM tells the drive which blocks are no longer in use so it can clean them up. Over time this is what stops a drive slowing down as it fills. Running it manually is useful on a drive that has been heavily used.
If you have a mechanical hard drive
HDD Optimize applies write caching and memory handling suited to spinning disks.
Defragmentation consolidates scattered files and moves them to the faster outer tracks of the disk. On an old drive full of installed and uninstalled games this can make a real difference.
Never defragment an SSD
It does nothing useful and it uses up write cycles. The app only offers defragmentation for mechanical drives, so if you do not see the option, that is why.
Defragmentation takes a long time
Hours, on a large drive that has never been done. Start it when you do not need the PC, leave it alone, and let it finish. Stopping partway is not harmful but you get less benefit.
Checking what you actually have
On Home, click More on any of the three tiles to open System Details. It lists your drives and their type, so you know which of the above applies before you change anything.
If a drive is failing
No optimization fixes failing hardware, and defragmenting a dying mechanical drive can hasten the end. If a drive is reporting problems, back up first and treat speed as the least of your concerns.
Related: Checking your specs.