Why is partial loading of matfile "inefficient" for -v7, but still faster?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Joseph Hall
le 23 Mar 2017
Modifié(e) : Joseph Hall
le 23 Mar 2017
When executing the following code, I get a warning that partial loading the -v7 *.mat file is "inefficient" and am told to use -v7.3 instead. However, when I test the execution times of each, it is actually the -v7 file which is faster. Why is this? To what "inefficiencies" does the warning refer?
>> whos
Name Size Bytes Class
b 1x1 8 double
c 641x143 366652 uint32
d 1x143 19296 cell
e 1x1 128 cell
>> save('G:\deletme0.mat','b','c','d','e')
>> save('G:\deletme1.mat','b','c','d','e','-v7.3')
>> save('G:\deletme2.mat','b','c','d','e','-v7.3','-nocompression')
>> tic; m = matfile('G:\deletme0.mat'); q = m.c(1:10,1:50); toc
Warning: The file 'G:\deletme0.mat' was saved in a format that does not support partial loading. Temporarily loading variable 'c' into memory. To use partial loading efficiently, save MAT-files with the -v7.3 flag. > In matlab.io.MatFile/inefficientPartialLoad (line 144) In matlab.io.MatFile/subsref (line 462)
Elapsed time is 0.009319 seconds.
>> tic; m = matfile('G:\deletme1.mat'); q = m.c(1:10,1:50); toc
Elapsed time is 0.013688 seconds.
>> tic; m = matfile('G:\deletme2.mat'); q = m.c(1:10,1:50); toc
Elapsed time is 0.013699 seconds.
0 commentaires
Réponse acceptée
Philip Borghesani
le 23 Mar 2017
V7 matfiles are faster in general and can be much faster if many small structures are saved. When working with large files containing large variables V7.3 files can be partially loaded reducing time and memory while the entire V7 file must be loaded to extract any variable.
You might see different results if the sizes of c and d were in the millions.
1 commentaire
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Workspace Variables and MAT-Files dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!