SSD TRIM: Restoring Performance Between Benchmark Passes
This article provides a comprehensive overview of how the SSD TRIM command restores drive performance between intensive hardware benchmarking passes. During heavy testing, solid-state drives experience significant speed degradation due to the physical limitations of NAND flash memory and the buildup of invalid data. By explaining the mechanics of data erasure, write amplification, and garbage collection, this guide illustrates how executing the TRIM command clears out deleted test files, resets the drive's available space, and ensures consistent, accurate results across consecutive benchmark runs.
The NAND Flash Limitation
To understand why an SSD slows down during benchmarking, you must understand how NAND flash memory writes data. Unlike traditional hard drives, an SSD cannot simply overwrite existing data with new data. Instead, the existing data must be completely erased before the space can be reused.
SSDs read and write data in small units called pages, which are grouped together into much larger units called blocks. While an SSD can read or write to a single page, it can only erase data an entire block at a time.
What Happens During a Heavy Benchmark Pass
Hardware benchmarks test an SSD by writing, reading, and deleting massive amounts of data in a short period. When a benchmark pass finishes and deletes its temporary test files, the operating system removes the files from its file system directory.
However, without the TRIM command, the operating system does not tell the SSD that those files are gone. To the SSD’s internal controller, those pages still appear to hold valid, important data.
If you immediately run a second heavy benchmark pass, the SSD runs out of fresh, empty pages. To write the new benchmark data, the drive is forced into a slow process known as the Read-Modify-Write cycle:
- The SSD copies the entire block (containing both valid data and the "deleted" benchmark data) into its internal cache.
- It erases the entire block on the NAND flash.
- It modifies the data in the cache, adding the new benchmark data.
- It writes the entire block back to the NAND flash.
This inefficiency is called write amplification. Because the SSD is forced to erase blocks right before writing to them, write speeds plummet during consecutive benchmark passes, skewing your test results.
How the TRIM Command Restores Performance
The TRIM command bridges the communication gap between the operating system and the SSD. When a benchmark deletes its test files at the end of a pass, the operating system sends a TRIM command to the SSD. This command tells the SSD's Flash Translation Layer (FTL) the exact locations of the pages that no longer contain valid data.
Once the TRIM command is executed, it triggers the SSD's internal Garbage Collection process during the idle period between benchmark passes. Here is how it restores performance:
- Identification: The SSD controller looks at the TRIM data and marks the pages containing the old benchmark files as "invalid."
- Consolidation: The Garbage Collection process moves any remaining valid data from partially full blocks into new blocks.
- Proactive Erasure: With only invalid data left behind, the SSD erases the entire block while the system is idle.
The Impact on Consecutive Benchmark Passes
When you give an SSD a few minutes of idle time after a TRIM command is issued, the drive cleans itself up. By the time you initiate the next heavy benchmark pass, the blocks have already been erased in the background.
Instead of suffering through the slow Read-Modify-Write penalty, the SSD can write the new benchmark data directly to the fresh, empty pages. This restores the drive's write speeds, prevents thermal throttling caused by excessive controller workload, and ensures that your subsequent benchmark passes accurately measure the hardware's peak capabilities rather than its bogged-down state.