This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Can cygwin boot faster?


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]