X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=0.0 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Message-ID: <49F8E62B.2050008@bodz.net> Date: Thu, 30 Apr 2009 07:43:39 +0800 From: Lenik User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b3pre) Gecko/20090223 Thunderbird/3.0b2 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Can cygwin boot faster? Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com I feel it has been slightly faster in cygwin-1.7 than cygwin-1.6. But it is still very slow compared to msys-1.10. What does cygwin indeed execute when start up? Is it loaded too much, for example the network libraries? I noticed that paths leading with two slashes '//', which is often created by path join functions, for example $prefix/somewhere, when $prefix points to the root "/". When such paths (//...) are accessed, cygwin seems to treat it as some kind of URL and halt for several seconds, while msys always merge the duplicated slashes to '/...'. Because of the slow speed, when I'm programming with cygwin, I will carefully to invoke command calls to the cygwin executables, to reduce the start up cost. for example, if I want to uppercase a string, I will do it in 26 built-in variable expansion as: VAR="${VAR//a/A}" VAR="${VAR//b/B}" VAR="${VAR//c/C}" ... VAR="${VAR//z/Z}" rather then by simply execute: VAR=$(echo $VAR | tr [a-z] [A-Z]) because, this execution will add 2 times of start-up delay, one for `bash`, and other one for `tr`. When my script will uppercase 100 or more words, that delay is unaffordable. # toupper VAR function toupper() { local v=${!1} v=${v//a/A} v=${v//b/B} v=${v//c/C} v=${v//d/D} v=${v//e/E} v=${v//f/F} v=${v//g/G} v=${v//h/H} v=${v//i/I} v=${v//j/J} v=${v//k/K} v=${v//l/L} v=${v//m/M} v=${v//n/N} v=${v//o/O} v=${v//p/P} v=${v//q/Q} v=${v//r/R} v=${v//s/S} v=${v//t/T} v=${v//u/U} v=${v//v/V} v=${v//w/W} v=${v//x/X} v=${v//y/Y} v=${v//z/Z} eval "$1=\"$v\"" } bash-3.2$ time -p for ((i=1; i<100; i++)); do var=$(echo $i | tr [a-z] [A-Z]); done real 13.57 user 8.40 sys 6.90 bash-3.2$ time -p for ((i=1; i<100; i++)); do var=$i; toupper var; done real 0.12 user 0.12 sys 0.00 If I try it on linux, though the first always slower, but it's a lot faster then in cygwin. This may be not a good example, what I mean is, I must consider the start up cost in cygwin, I write scripts in bash, and using binutils etc. to get the programs look more elegant and more precise, and more portable, but If I consider too much start up cost, the result code must be very dirty. Any ideas? Lenik -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/