Subj : sweep
To   : Eddy Thilleman
From : Vitus Jensen
Date : Sun Apr 01 2001 04:53 am

Moin Eddy!

15.03.2001, Eddy Thilleman wrote a message to Vitus Jensen:

(please pardon my late answer, we had CeBIT here in Hannover)

ET>>>>> Borland Pascal as DOS .EXE file and compiled it with Virtual
ET>>>>> Pascal/2 v2.1 build 243 as OS/2 .EXE file, and implemented it
ET>>>>> also in REXX.
...
ET>>> I've run it without screen output from all the sweep variants
ET>>> themselves, the only screen output is by the command run in each
ET>>> (sub)directory. The command in the compiled OS/2 version is run
ET>>> somewhat slower.

VJ>> There are larger gaps between execution in the different directories?
ET> Yes.

VJ>> That would mean that searching for directories is slower in VP/2
VJ>> which is not to be expected or the startup of every command line
VJ>> takes longer (s.b.).
ET> I'm not sure about this.
...
ET> The DOS pascal version is equally fast as the REXX version, the OS/2
ET> VP/2 version is slower (as I said).
...
ET> Any ideas?

I tried your Rexx code and translated the pascal version to C.  When run both
versions in my source tree on the file server (413 dirs) the results are:

timex sweep.cmd -Q cmd.exe /C cd
Elapsed time: 26.67 seconds

timex sweep.exe -Q cd
Elapsed time: 18.68 seconds

So rexx is slower over here.  As it is different on your machine it has to do
something with VP/2.

BTW, here is the code:

=====================<start>================================
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <direct.h>

#define INCL_DOS
#include <os2.h>


static int      fQuiet = 0;
static char     szPrgName[_MAX_PATH];
static char     szCmdLine[_MAX_PATH] = "";


static void
AllDirs(void)
{
   int err;

   if( !fQuiet )
   {
       char    pad[_MAX_PATH];
       _getcwd(pad, _MAX_PATH);
       printf(">>> SWEEP >>> %s\n", pad);
   }

   err = system(szCmdLine);
   if( err == 0 )
   {
       HDIR            hdir = HDIR_CREATE;
       FILEFINDBUF3    fbuf;
       ULONG           cnt;
       APIRET          rc;

       cnt = 1;                                /* one at a time */
       rc = DosFindFirst("*", &hdir,
                         MUST_HAVE_DIRECTORY
                         | FILE_ARCHIVED | FILE_DIRECTORY
                         | FILE_SYSTEM | FILE_HIDDEN | FILE_READONLY,
                         &fbuf, sizeof(fbuf),
                         &cnt,
                         FIL_STANDARD);
       if( rc == 0 )
       {
           do
           {
               if( !(strcmp(fbuf.achName, ".") == 0
                     ||  strcmp(fbuf.achName, "..") == 0) )
               {
                   chdir(fbuf.achName);
                   AllDirs();
                   chdir("..");
               }
               cnt = 1;
               rc = DosFindNext(hdir, &fbuf, sizeof(fbuf), &cnt);
           }
           while( rc == 0 );
           DosFindClose(hdir);
       }
   } /* end[if(err==0)] */

   return;
}


int
main(int argc, char * argv[])
{
   int i;

   strcpy(szPrgName, argv[0]);
   while( argc > 1  &&  (argv[1][0] == '-' || argv[1][0] == '/') )
   {
       switch( argv[1][1] )
       {
         case 'q':
         case 'Q':
           fQuiet = 1;
           break;

         default:
           fprintf(stderr, "%s: unknown arg \"%s\"\n", szPrgName, argv[1]);
           return -1;
       }
       --argc;
       ++argv;
   }
   for( i = 1; i < argc; ++i )
   {
       strcat(szCmdLine, argv[i]);        /* Bug, I know */
   }

   printf("command: %s\n", szCmdLine);
   AllDirs();

   return 0;
}
======================<end>=================================



Bye,
  Vitus

PS: you don't do a FindClose in your pascal code.

---
* Origin: This tagline does not require Microsoft Windows (2:2474/424.1)