Why is partial loading of matfile "inefficient" for -v7, but still faster?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Joseph Hall
el 23 de Mzo. de 2017
Editada: Joseph Hall
el 23 de Mzo. de 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 comentarios
Respuesta aceptada
Philip Borghesani
el 23 de Mzo. de 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 comentario
Más respuestas (0)
Ver también
Categorías
Más información sobre Workspace Variables and MAT-Files en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!