Article View: comp.lang.modula2
Article #2365Re: TopSpeed 3.0 First Impressions
From: Gerhardt Vogt
Date: Sun, 23 Jun 1991 17:19
Date: Sun, 23 Jun 1991 17:19
67 lines
2864 bytes
2864 bytes
In a previous posting, Tom Almy tried to compare JPI's speed of String-
output to textfiles in M2 and C.
> Language Size Speed
> Modula-2 Nobuf 5620 1.64
> Modula-2 Buf 6525 6.81 (NOT a misprint!)
> C Nobuf 4654 12.58
> C Buffered 4750 0.93
The 6.81 seconds are not a misprint but Tom's error.
> MODULE test;
> IMPORT FIO;
> IMPORT Storage;
>
> CONST BufferSize = 1024 + FIO.BufferOverhead;
>
> VAR i:CARDINAL;
> dummy: FIO.File;
> buffer: ADDRESS;
>
> BEGIN
> dummy := FIO.Create("test.out");
> Storage.ALLOCATE(buffer,BufferSize);
> FIO.AssignBuffer(dummy, buffer);
> FOR i := 0 TO 1000 DO
> FIO.WrStr(dummy,"This is a test of writing speed");
> FIO.WrLn(dummy);
> END;
> END test.
The AssignBuffer does not take the length of the buffer as an explicit
argument but uses the implicit size which is 4 in case of a ADDRESS
variable. Using a 4 byte buffer wouldn't be fast in any language. The
proper usage of AssignBuffer is
TYPE
Array = ARRAY[0 .. BufferSize - 1] OF CHAR;
VAR
buffer : POINTER TO Array;
.
.
.
FIO.AssignBuffer(dummy, buffer^);
Here AssignBuffer gets the proper size as an implicit argument and the program
is running about 1.2 seconds buffered and 12 seconds unbuffered on a 386 SX
with 16 MHz and a 18 ms disk (without Smartdrive and Co).
I agree with people who loved version 1. I asked several times people from JPI
which powerful features of V1 do not exist anymore (for examples VID's feature
to let you examine all local and global variables after a runtime error and
to let the program continue in such a case. PMD is nice if a program crashes
rarely but letting a program run in the debugger until it crashed is much
more convenient). And I don't understand why they removed programs like
ANALYZE which produces a list who exports and imports what.
On the other hand they do not want to include features in Modula which are
standard in C like a check for uninitialized or unused variables which should
be quite simple because the optimizer has to maintain this information anyway
(I was told that they have asked the compiler writer but that he does not
want to do it)
Anyway, i still like it very much
Gerhard Vogt
EMBL
D-6900 Heidelberg
West Germany
Technical Details
Message-ID:
<56F0AA44FD1F400E38@EMBL-Heidelberg.DE>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!EMBL.BITNET!VOGTShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!EMBL.BITNET!VOGT From: VOGT@EMBL.BITNET (Gerhardt Vogt) Newsgroups: comp.lang.modula2 Subject: Re: TopSpeed 3.0 First Impressions Message-ID: <56F0AA44FD1F400E38@EMBL-Heidelberg.DE> Date: 23 Jun 91 17:19:00 GMT Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: Modula2 List <INFO-M2%UCF1VM.BITNET@ucf1vm.cc.ucf.edu> Organization: The Internet Lines: 67