This is the mail archive of the cygwin@cygwin.com 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]

RE: Cygwin is SLOW.


Well, it might help to identify the "test script" as a perl script.
Plus, you got an extra double-quote in there.  This script has a chance
of running:
#!/usr/local/bin/perl
chmod ( 000, "test.file" ) || die "chmod test.file: $!";
-w "test.file" || die "cannot change test.file's permissions $!";
$t = time;
while( $t == time ) {}
$t = time;
$secs = 5;
$stop = $t + $secs;
while( time < $stop ) {
  system( "chmod 777 test.file" ) == 0 or die "blah, $!";
  $n++;
}
print $n / $secs, " chmods per sec\n";
-w "test.file" || die "test.file is not writeable: $!";



However, I find that I get a rather odd result: 
The script reports failure, even though it successfully changes the mode.
$ chmod 555 test.file

bab@PORT /D/site/src/cwt
$ ll
total 2
-rw-rw-rw-    1 bab      DomUsers      408 Jul 16 13:33 chm
-rw-rw-rw-    1 bab      DomUsers      409 Jul 16 13:32 chm~
-r-xr-xr-x    1 bab      DomUsers        0 Jul 16 13:28 test.file

bab@PORT /D/site/src/cwt
$ ./chm
cannot change test.file's permissions Permission denied at ./chm line 3.

bab@PORT /D/site/src/cwt
$ ll
total 2
-rw-rw-rw-    1 bab      DomUsers      408 Jul 16 13:33 chm
-rw-rw-rw-    1 bab      DomUsers      409 Jul 16 13:32 chm~
----------    1 bab      DomUsers        0 Jul 16 13:28 test.file


Hmm, I guess you've got another error:
Here's the fix:
#!/usr/local/bin/perl
chmod ( 000, "test.file" ) || die "chmod test.file: $!";
-w "test.file" && die "cannot change test.file's permissions $!";
$t = time;
while( $t == time ) {}
$t = time;
$secs = 5;
$stop = $t + $secs;
while( time < $stop ) {
  system( "chmod 777 test.file" ) == 0 or die "blah, $!";
  $n++;
}
print $n / $secs, " chmods per sec\n";
-w "test.file" || die "test.file is not writeable: $!";


$ ./chm
41 chmods per sec

Yep, that's slow.

Next time, try pasting the _actual_ script that you're using.

But it's not as slow as this older perl:
$ /Y/depot/winnt/perl/5.00501/bin/mswin32-x86/perl.exe chm
5 chmods per sec

In this case, y: is a network mapped drive.  That probably hurts.
In fact for this case, which chmod is
D:\site\src\cwt>which chmod
y:/depot/winnt/bin/chmod.exe

You're script isn't just doing chmod, though, it's doing SYSTEM chmod.

So, chmod has to be searched for over my path, and ends up coming over the
network.  No wonder it's slow.

Under Cygwin Bash, the PATH is different, so 
$ which chmod
/usr/bin/chmod

Which is a local cygwin mount drive.  

If you want it to run fast, avoid system().
Try this:
$ perl chm.pl
1017.4 chmods per sec

$file = "test.file";
chmod ( 0700, ($file) ) || die "chmod ( 0000, (\"$file\") ): $!";
-w $file || die "perl chmod will fail w/o write permission on $file\n";
$t = time;
while( $t == time ) {}
$t = time;
$secs = 5;
$stop = $t + $secs;
while( time < $stop ) {
  chmod (0777, ($file) ) == 1 or die "blah, $!";
  $n++;
}
print $n / $secs, " chmods per sec\n";
-w $file || die "test.file is not writeable: $!";

> -----Original Message-----
> From: cygwin-owner@cygwin.com [mailto:cygwin-owner@cygwin.com]On Behalf
> Of David E. Weekly
> Sent: Tuesday, July 16, 2002 2:58 AM
> To: cygwin
> Subject: Cygwin is SLOW.
> 
> 
> Modern cygwins seem to be very slow. "Modern" meaning built within the last
> 6 months or so, and "slow" means that many basic file operations, such as
> "chmod", seem to be >10x slower (measured, not exaggerating) than previous
> cygwins. This is creating a pretty tight situation at our company as we're
> having to rewrite scripts, etc, to work around this. The sample test script
> below should demonstrate the problem. With "old" cygwins I got nearly 1000
> chmod's second on my workstation. With "new" cygwins I get under a dozen.
> The comparison was done on the same machine, same filesystem (NTFS) with
> otherwise identical conditions.
> 
> Have others been running into this? We're seeing this on all the machines at
> our company, so I'm pretty convinced it's not just a localized wierdness or
> misconfiguration. We'd love to be using Cygwin, but we may have to bail if
> we can't get it to run acceptably fast.
> 
> -david
> 
> 
> =====================================
> 
> 
> chmod ( 000, "test.file" ) || die "chmod test.file: $!";
> -w "test.file" || die "cannot change test.file's permissions" $!";
> $t = time;
> while( $t == time ) {}
> $t = time;
> $secs = 5;
> $stop = $t + $secs;
> while( time < $stop ) {
>   system( "chmod 777 test.file" ) == 0 or die "blah, $!";
>   $n++;
> }
> print $n / $secs, " chmods per sec\n";
> -w "test.file" || die "test.file is not writeable: $!";
> 
> 
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting:         http://cygwin.com/bugs.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.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]