delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/07/16/10:04:58

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: "Bernard A Badger" <bab AT vx DOT com>
To: "David E. Weekly" <david AT there DOT com>, "cygwin" <cygwin AT cygwin DOT com>
Subject: RE: Cygwin is SLOW.
Date: Tue, 16 Jul 2002 10:06:53 -0400
Message-ID: <INEKLKBFCDBPKMKAJLMDOEPKCFAA.bab@vx.com>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
In-Reply-To: <LHEEIFOFMFKJEJHIKLJCGENECEAA.david@there.com>
X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Importance: Normal

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 AT 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 AT PORT /D/site/src/cwt
$ ./chm
cannot change test.file's permissions Permission denied at ./chm line 3.

bab AT 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 AT cygwin DOT com [mailto:cygwin-owner AT cygwin DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019