[Python-checkins] python/dist/src/Demo/threads find.py,1.6,1.7

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Fri, 18 Oct 2002 11:20:35 -0700


Update of /cvsroot/python/python/dist/src/Demo/threads
In directory usw-pr-cvs1:/tmp/cvs-serv26484

Modified Files:
	find.py 
Log Message:
Note lack of speedup.  Remove Irix reference.  Remove silly extra
'/tmp' arg.  Change predicate to look for world-writable non-symlink
files.


Index: find.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Demo/threads/find.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** find.py	21 Jan 2001 07:06:51 -0000	1.6
--- find.py	18 Oct 2002 18:20:33 -0000	1.7
***************
*** 4,15 ****
  # It really does do more stats/sec when using multiple threads,
  # although the improvement is only about 20-30 percent.
  
  # I'm too lazy to write a command line parser for the full find(1)
  # command line syntax, so the predicate it searches for is wired-in,
  # see function selector() below.  (It currently searches for files with
! # group or world write permission.)
  
  # Usage: parfind.py [-w nworkers] [directory] ...
! # Default nworkers is 4, maximum appears to be 8 (on Irix 4.0.2)
  
  
--- 4,17 ----
  # It really does do more stats/sec when using multiple threads,
  # although the improvement is only about 20-30 percent.
+ # (That was 8 years ago.  In 2002, on Linux, I can't measure
+ # a speedup. :-( )
  
  # I'm too lazy to write a command line parser for the full find(1)
  # command line syntax, so the predicate it searches for is wired-in,
  # see function selector() below.  (It currently searches for files with
! # world write permission.)
  
  # Usage: parfind.py [-w nworkers] [directory] ...
! # Default nworkers is 4
  
  
***************
*** 99,103 ****
  
  def main():
-     sys.argv.append("/tmp")
      nworkers = 4
      opts, args = getopt.getopt(sys.argv[1:], '-w:')
--- 101,104 ----
***************
*** 123,128 ****
  
  def selector(dir, name, fullname, stat):
!     # Look for group or world writable files
!     return (stat[ST_MODE] & 0022) != 0
  
  
--- 124,129 ----
  
  def selector(dir, name, fullname, stat):
!     # Look for world writable files that are not symlinks
!     return (stat[ST_MODE] & 0002) != 0 and not S_ISLNK(stat[ST_MODE])