Having a performance issue for this code. Is this normal or not?

5 visualizaciones (últimos 30 días)
Scotty
Scotty el 12 de Nov. de 2012
here is the code I am experiencing a performance slowdown with, I have tested is vs my home pc (Win7 x64 8gb, and WinXP x32 4gb)and both outperformed. What gives?
Note: the files I am copying are flat files of the fuill history for each ticker. With the largest file being 840kb and only 115 files over 350kb. And the total file list;
>> size(tickers)
ans =
3408.00
tic
for i = 1:length(tickers)
copyfile(strcat('C:\data\temp\', tickers{i}, 'yahoo.txt'), 'C:\data\yahoo\');
fprintf('Finished copying %s ...\n',tickers{i});
end
toc
Elapsed time is 111.649063 seconds
  • System Specs:
  • Windows Windows 7 Professional Edition (64-bit) Service Pack 1 (Build 7601)
  • Memory (RAM) 4062 MB
  • CPU Info Intel® Xeon® CPU E31270 @ 3.40GHz
  • CPU Speed 3392.4 MHz
  • Manufacturer * HP
  • Product Make * ProLiant DL120 G7

Respuestas (1)

Jan
Jan el 12 de Nov. de 2012
Editada: Jan el 12 de Nov. de 2012
Size will surely not reply a floating point number, except if you have shadowed the built-in function by a local variable:
size = rand(10);
tickers = 5;
size(tickers)
You want to copy 3400 files of about 500kB. This means reading writing 1.7GB. When reading and writing happens on the same disk, you can expect the time of writing 3.4GB. When the disk is fragmented, or if it is network drive, 111 seconds are not completely mad.
You mention, that you see a slowdown. Then please explain if you see it between Matlab versions, operating systems, different disks or growing over time, and in the last case, if "time" means minuts, hours, weeks or years. In addition it is important to mention the Matlab version you are using. E.g. old version of Matlab have opened a DOS box to copy files - bad idea.
Please check if the virus checker occupies a lot of computing power during the processing.
You see an extremely slow file handling e.g. short before the final collapse of a hard disk. So please check the disk.
  5 comentarios
Jan
Jan el 13 de Nov. de 2012
As shown in my profile page I'm working in Heidelberg, Germany.
Scotty
Scotty el 13 de Nov. de 2012
Saw that right after I replied... nice place I have been there.

Iniciar sesión para comentar.

Categorías

Más información sobre Matrix Indexing 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!

Translated by