Why the external dos command/program is so slow in 64 bit window?

8 ビュー (過去 30 日間)
Zhi
Zhi 2011 年 2 月 22 日
編集済み: Jan 2017 年 5 月 3 日
Hi,
I try executing some external commands/programs in Matlab (R2010a, 64bit) but they are very slow. Here is an example: Matlab program: disp('Test external command in Matlab');
for i = 1:5 tic system('cd .'); toc end
Results: Test external command in Matlab Elapsed time is 7.136996 seconds. Elapsed time is 6.094630 seconds. Elapsed time is 5.574957 seconds. Elapsed time is 6.235473 seconds. Elapsed time is 5.973438 seconds.
My computer is Dell Optiplex 980, Windows 7. I have not met the same problem in Linux or 32bit Matlab.

回答 (4 件)

Jan
Jan 2011 年 2 月 22 日
編集済み: Jan 2017 年 5 月 3 日
This can depend on "cd .". If the current directory contains 7000 files and is on a network drive connected by a 100MBit ethernet, 6 seconds are not really surprising.

the cyclist
the cyclist 2011 年 2 月 22 日
I am using R2010b on a 64-bit Mac, and I do not see that behavior. My elapsed times are on the order of milliseconds.

Aviv Rosenberg
Aviv Rosenberg 2016 年 10 月 31 日
編集済み: Walter Roberson 2016 年 10 月 31 日
Try this:
Haven't tested on windows, but it really speeds up my workflow on OSX.
  1 件のコメント
Walter Roberson
Walter Roberson 2016 年 10 月 31 日
I notice that the source does
pb.redirectErrorStream(true);
I am wondering if that affects explicit I/O redirection the user may have given on the command line, such as if the command were
someCommand SomeArguments 2>SomeOutputFile
because the user wanted stderr to go to a file?

サインインしてコメントする。


Xiangrui Li
Xiangrui Li 2017 年 5 月 3 日
I observed the slowness for both win32 and win64. I just posted a question why redirecting the output to a file improve the performance. It is strange that, even if there is no output, redirecting still makes it faster.
tic, for i = 1:5, system('cd .'); end; toc
Elapsed time is 0.627796 seconds.
tic, for i = 1:5, system('cd . >myFile'); end; toc
Elapsed time is 0.111956 seconds.

カテゴリ

Help Center および File ExchangeWeb Services についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by