MATLAB: Do I not notice performance differences when saving MAT-files to an SSD vs an HDD

-v7.3.mat filecompressiondrivehddMATLABoptimizationperformancesavessdstorage

I ran a saving test to measure the performance of MATLAB when saving MAT-files to various storage drives. I expected that saving large amounts of data to an SSD would be significantly faster than saving to an HDD, but only observed negligible differences in the saving time. Why am I not seeing better timing results for the SSD?
Example test code:
for i=1:1:1000
eval(['p',num2str(i),'=1:1:2e5;'])
end
test=1;
save test test
tic
for i=1:1:1000
eval(['save(','''','test','''',',','''','p',num2str(i),'''',',','''','-append','-v7.3','''',')'])
end
toc

Best Answer

In MATLAB, compression can be a large bottleneck of save operations. In the test code above, 90% of the time is spent compressing the data that will be written to the MAT-file. Thus, the performance results observed are not accurately depicting the comparative speed of writing to different storage drives.
In order to isolate the performance of writing to disk, time a 'save' operation that does not compress the data being saved.
You can do so by calling 'save' with the flags '-v7.3' and '-nocompression'. The first flag, '-v7.3', lets you save to a Version 7.3 MAT-file, which supports saving large variables without compressing them. The second flag, '-nocompression', allows you to save without compressing your data. You can see an example of both of these flags in use here:
Using these flags will make a 'save' operation significantly faster, and will allow you to observe distinct performance differences when saving to different types of drives.