...I've written a sweep command in pascal and compiled it with
Borland Pascal as DOS .EXE file and compiled it with Virtual
Pascal/2 v2.1 build 243 as OS/2 .EXE file, and implemented it
also in REXX.
another example
sweep for %a in (*.bak) do echo %a
The compiled version is easier to use than the REXX variant.
Shall I post the source of all three?
Are you sure it's the screen output?No, I'm not certain.
If not, remove screen output from the program and rerun it.
I've run it without screen output from all the sweep variants
themselves, the only screen output is by the command run in each (sub)directory. The command in the compiled OS/2 version is run
somewhat slower.
If you know the offending part in the OS/2 EXE it may be an idea toI don't know what the cause is. My best guess is that the loading and initializing of cmd.exe takes more time than command.com. Cmd.exe and command.com are located on the same partition. In a few days (I don't
post that part.
have the time at the moment), I'll put a copy of cmd.exe on a ramdisk
and modify the sweep pascal source code to start the cmd.exe file on
the ramdisk, to see if that cuts down the difference.
...Borland Pascal as DOS .EXE file and compiled it with Virtual
Pascal/2 v2.1 build 243 as OS/2 .EXE file, and implemented it
also in REXX.
another example
sweep for %a in (*.bak) do echo %a
The compiled version is easier to use than the REXX variant.
"easier to use"? I would expect the rexx variant to be easier to
code.
\os2\rexx\sweep for %a in (*.txt) do echo %aSYS1079: a was unexpected at this time.
Command >> for %a in (*.txt) do echo %a
Sweep >>> C:\
\os2\rexx\sweep cmd /c for %a in (*.txt) do echo %aSYS1079: a was unexpected at this time.
Command >> cmd /c for %a in (*.txt) do echo %a
Sweep >>> C:\
\os2\rexx\sweep cmd /c for %%a in (*.txt) do echo %%aError? rc=31112
Command >> cmd /c for %%a in (*.txt) do echo %%a
Sweep >>> C:\
\os2\rexx\sweep cmd /c for %a in (*.txt) do echo %aSYS1079: a was unexpected at this time.
Command >> cmd /c for %a in (*.txt) do echo %a
Sweep >>> C:\
Shall I post the source of all three?
Are you sure it's the screen output?
No, I'm not certain.
If not, remove screen output from the program and rerun it.
I've run it without screen output from all the sweep variants
themselves, the only screen output is by the command run in each
(sub)directory. The command in the compiled OS/2 version is run
somewhat slower.
There are larger gaps between execution in the different directories?
That would mean that searching for directories is slower in VP/2
which is not to be expected or the startup of every command line takes longer (s.b.).
(how do you do it?),
cmd.exe should already reside in the disk cache so the difference
should be small or non existent.
You are executing all commands through cmd.exe when coding in pascal.
How do you do it in Rexx?
If you just let the already running copy of cmd.exe handle it we have
a major difference: a new process for cmd.exe does not have to be
started. Try to compare the following times,
Rexx: sweep cmd /C "for %a in (*.bak) do echo %a"
Pascal: sweep for %a in (*.bak) do echo %a
I've written a sweep command in pascal and compiled it with
Borland Pascal as DOS .EXE file and compiled it with Virtual
Pascal/2 v2.1 build 243 as OS/2 .EXE file, and implemented it
also in REXX.
I'm still uncertain what a "sweep" program means. I program which
searches the disk for certain files (.bak, etc) and removes them?
The usual reason is that you display one character at a time. If you
have control over the code which does the screen output (e.g. you are directly calling Vio*) try to buffer characters.
Shall I post the source of all three?
Are you sure it's the screen output?
If not, remove screen output from the program and rerun it.
If you know the offending part in the OS/2 EXE it may be an idea to
post that part.
Borland Pascal as DOS .EXE file and compiled it with Virtual
Pascal/2 v2.1 build 243 as OS/2 .EXE file, and implemented it
also in REXX.
FindFirst('*', Directory, DR);
while (DosError = 0) do
begin
if (DR.Attr and Directory) = Directory then
begin
if ((DR.Name <> '.') and (DR.Name <> '..')) then
begin
ChDir( DR.Name );
AllDirs;
ChDir( '..' );
end
end;
FindNext( DR );
end;
Call SysFileTree path || "\*", 'dir', 'D'
if datatype( dir.0 ) <> "NUM" then dir.0 = 0
do f = 1 to dir.0
name = substr( dir.f, 38 )
if (substr( dir.f, 32, 1 ) = 'D') then /* directory? */
call Exec( name )
end
The DOS pascal version is equally fast as the REXX version, the
OS/2 VP/2 version is slower (as I said).
I think it is possible, that SysFileTree and OS/2 DOS support are
simply caching directory search and do not call
DosFindFirst/DosFindNext for every filename. These functions allow to request information about ~64K filenames at once, and IMHO this can
result in speeding up the process greately.
While SysFileTree is obviously must use such a technique, I am in
doubt if OS/2 DOS support does so actually. Try to replace running
external programs with somewhat fast enough (may be without any
output) to figure out if the main brake is FindFirst/FindNext or not.
While SysFileTree is obviously must use such a technique, I> am in doubt if OS/2 DOS support does so actually. Try to
uses dos;
Exec( Prog, Parm );
if DOSError = 0 then
...Borland Pascal as DOS .EXE file and compiled it with Virtual
Pascal/2 v2.1 build 243 as OS/2 .EXE file, and implemented it
also in REXX.
...I've run it without screen output from all the sweep variants
themselves, the only screen output is by the command run in each
(sub)directory. The command in the compiled OS/2 version is run
somewhat slower.
There are larger gaps between execution in the different directories?Yes.
That would mean that searching for directories is slower in VP/2I'm not sure about this.
which is not to be expected or the startup of every command line
takes longer (s.b.).
The DOS pascal version is equally fast as the REXX version, the OS/2...
VP/2 version is slower (as I said).
Any ideas?
uses dos;
Exec( Prog, Parm );
if DOSError = 0 then
(please pardon my late answer, we had CeBIT here in Hannover)
So rexx is slower over here. As it is different on your machine it
has to do something with VP/2.
PS: you don't do a FindClose in your pascal code.
Sunday 01 April 2001 11:53, Vitus Jensen wrote to Eddy Thilleman:
(please pardon my late answer, we had CeBIT here in Hannover)Have you visited the CeBIT? I have read it was the largest CeBIT ever.
So rexx is slower over here. As it is different on your machine itIt's possible. I'll look at doing the API calls directly, when I've
has to do something with VP/2.
time.
My system runs OS/2 Warp v4 fixpak 9. Yours?
PS: you don't do a FindClose in your pascal code.Jonathan said that too. :) I forgot it, but I'll include in my version with the direct API calls. When I've converted the pascal version to
the API calls, I'll post that new version and include the results.
The company where I work daytime (Hoeft & Wessel AG) had a booth as
every year. But this time a demonstration with a new product was
shown . And ... it did not work. I did the OS (porting) and
application. A small computer to be installed in a truck, collecting
data from a handheld and transmitting it to an FTP server via GSM. So
any problem in the setup involved in one way or another my small
computer. :-(
My system runs OS/2 Warp v4 fixpak 9. Yours?
Warp 4 FP 6.
When you forget the DosFindClose it won't hurt unless you try it on a really deep directory structure.
How deep? I did not find any documention on the toolkit...
I also need to write software [...] to unpack any archive file (automatically detecting if a file is an archive at all, and if
then which archive), [...]
Do I need to change or replace the lines with DosFindFirst() andDosFindNext()
or should I just change the number of entries to find? Problably I needextra
calls to DosFindFirst() and DosFindNext() to iterate over entries in thebuffer?
How would I make them work with the entries in the buffer?
This new version of sweep has the same small delays as the
previous one, so these delays might be caused by calling the
command interpreter (CMD.EXE on my system).
Sysop: | digital man |
---|---|
Location: | Riverside County, California |
Users: | 1,041 |
Nodes: | 17 (0 / 17) |
Uptime: | 13:08:58 |
Calls: | 501,715 |
Calls today: | 8 |
Files: | 104,421 |
D/L today: |
6,140 files (2,348M bytes) |
Messages: | 298,459 |
Posted today: | 2 |