2012-06-14 11 views
7

をcygwinのされて、私はUbuntuの上でスクリプトを実行し、その時間をテストした:がなぜこれほど遅い

$ time ./merger 
./merger 0.02s user 0.03s system 99% cpu 0.050 total 

それは1秒未満を過ごしました。 私はcygwinの使用している場合:

$ time ./merger 
real 3m22.407s 
user 0m0.367s 
sys  0m0.354s 

のそれは3分以上を費やしました。 これはなぜ発生しましたか? cygwinの実行速度を上げるためにはどうすればよいですか?

+2

Windowsでの生成プロセスはLinuxに比べて非常に遅いです。cygwinがこの制限を回避するために行うことはあまりありません。 –

+0

[this](http://stackoverflow.com/questions/2835775/msysgit-bash-is-horrendously-slow-in-windows-7)が役立つかどうかを確認してください。 –

+0

@PaulRだが、3分遅れで遅くなるとは思わない。私は、OPがこれを試してみたときに、他のプロセスがウィンドウで動作していたと思います。あるいは彼は、彼のプログラムの中で、WindowsとLinuxで大きく異なるものを使用しました。 –

答えて

1

他にも言及したように、Windows上でのフォークとプロセスの生成は一般に遅いですが、Cygwin's implementationです。 this fork() benchmark使用

が、私は次のような結果を得る:ベンチマークプロセスの産卵性能にtime (for i in {1..10000};do cat /dev/null;done)を使用して

[email protected]:~$ ./test 1000 
Forked, executed and destroyed 1000 processes in 5.660011 seconds. 

[email protected]:~$ ./test 1000 
Forked, executed and destroyed 1000 processes in 0.142595 seconds. 

[email protected]:~$ ./test 1000 
Forked, executed and destroyed 1000 processes in 1.141982 seconds. 

を、私は、次の取得結果:

[email protected]:~$ time (for i in {1..10000};do cat /dev/null;done) 
(...) 19.11s user 38.13s system 87% cpu 1:05.48 total 

[email protected]:~$ time (for i in {1..10000};do cat /dev/null;done) 
(...) 0.06s user 0.56s system 18% cpu 3.407 total 

[email protected]:~$ time (for i in {1..10000};do cat /dev/null;done) 
(...) 0.51s user 4.98s system 21% cpu 25.354 total 

ハードウェアの仕様:

  • cygwinのIntel(R) Core(TM) i7-3770K CPU @ 3.50GHz
  • アーチIntel(R) Core(TM) i7-4790K CPU @ 4.00GHz
  • のdebian:あなたは関係なく、あなたが使用しているもの、見ないようにIntel(R) Core(TM)2 Duo CPU T5270 @ 1.40GHz

、Cygwinは常に悪化して動作します。ハードウェアを悪化させても手を失います(このベンチマークの対debianthis comparison)。

関連する問題