Openning 14000 tif files...
Ältere Kommentare anzeigen
Hello,
I am trying to optimize the time taken to open ~14000 tif files of about 400KB each.
I have tried different approaches essentially based on killing what I do not need and monitoring that with the profiler. But the results seem inconsistent from one run to another.
Essentially my test is the following: I evaluate 3 different ways of operating (from the worst to the best I hope...), for the last ones I have copied rtifc.mexw64 in the current folder.
%%imread
im = zeros(424,424,14000,'uint16');
tic
for k = 1:length(fname)
tmpf = [Folder fname{k}];
tim = imread(tmpf);
im(:,:,k) = tim;
end
T = toc;
[T T/14]
clear im tim tmpf
%%feval tifread
im = zeros(424,424,14000,'uint16');
tic
tf = imformats('tif');
for k = 1:length(fname)
tmpf = [Folder fname{k}];
tim = feval(tf.read, tmpf,1 );
im(1:424,1:424,k) = tim;
end
T = toc;
[T T/14]
clear im tim tmpf
%%rtifc
im = zeros(424,424,14000,'uint16');
tic
tmp.index =1;
tmp.PixelRegion = {[1 424],[1 424]};
tmp.info = imfinfo([Folder fname{1}]);
for k = 1:length(fname)
tmp.filename = [Folder fname{k}];
[tim,trash1,trash2] = rtifc(tmp);
im(1:424,1:424,k) = tim;
end
T = toc;
[T T/14]
clear im tim tmpf
From there I have 2 points:
1. There is no big improvement between the 3...
- 70s 67s 66s
- 69s 63s 64s
- 66s 64s 61s
2. From one run to another I have sometime massive differences for the 3 methods: 29s 18s 16s
Do you have any suggestion? What am I doing wrong? THANK YOU!!! :)
1 Kommentar
Jan
am 18 Mär. 2013
im(1:424,1:424,k) = tim; is slower than im(:,:,k) = tim;, but this will not effect the total runtime significantly.
Akzeptierte Antwort
Weitere Antworten (2)
Sean de Wolski
am 18 Mär. 2013
If you have the Parallel Computing Toolbox; how about using parfor?
doc parfor
If you do not have the PCT, I'm sure your friendly Sales Rep could set you up with a trial.
1 Kommentar
Jobi
am 18 Mär. 2013
Jan
am 18 Mär. 2013
0 Stimmen
accessing the hard disk is influenced by many different factors: Disk fragmentation, defragmentation tools, other jobs accessing the disk, weak blocks which are moved transparently, virus checkers which check modified files at the first access, downloads of updates in the background, other tasks which swap data to the disk, etc. Therefore a difference of 50% is not very surprising.
The best setup for a speed measurement with disk access is using a dedicated disk (not partition!) for the data.
1 Kommentar
Jobi
am 19 Mär. 2013
Kategorien
Mehr zu Communications Toolbox finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!