View Full Version : Turbo Pascal 5.5 vs Turbo Pascal 3.02
norayr
December 14th, 2003, 03:04 AM
So, I tell in one topic, that TP 3.0 makes a slow and unfaily big code.
To prove my words I made some tests.
Tried a simple mathematical function in a for... to... cycle 1966050 times.
First of all, Pascal 3.0 did not understand neither longint nor word variables.
So I must use integer value that can't ve more than 65535.
I used 30 cycles in one program, that is 1966050 times.
So, code generated by Pascal 3.02 is about 13.7 kb.
Code generated with Pascal 5.5 was only 2.4 kb.
Then...
Speed, and code optimisation.
TP 3.02 geterated binary worked about 10 seconds, a little less than 11 secs.
Tp 5.5 generated code works less than one second.
By the way, Tp 7.1 generated binary works even less than code generated with TP 5.5
That's all.
Interesting to read CP/M User's comments :)
carlsson
December 14th, 2003, 12:30 PM
Did you have the opportunity to try Turbo C 1.0 or equivalent? I tend to remember that TP 3 and TC 1 are of the same age.
norayr
December 15th, 2003, 10:51 AM
:)
No, I only remember that both Borland C and Pascal has made slow graphics with craqppy egavga.bgi :)
CP/M User
December 20th, 2003, 03:45 PM
"norayr" wrote in message:
> :)
> No, I only remember that both
> Borland C and Pascal has made
> slow graphics with craqppy
> egavga.bgi :)
Using the units in Turbo Pascal (5.5 in particular)
is a pain when it comes to portability & it's only
just okay for the simple things. After visiting the
SWAG archives, things start to open up, in that
lots of routines written there have their own
Assembly routines which are much faster than
using the unit equivalent.
Cheers,
CP/M User.
CP/M User
December 20th, 2003, 03:50 PM
"carlsson" wrote in message:
> Did you have the opportunity to try
> Turbo C 1.0 or equivalent? I tend
> to remember that TP 3 and TC 1
> are of the same age.
It's a bit of a shame that Turbo C didn't
make it to CP/M, while CP/M has a number
of C compilers, I haven't done a lot in that
department, except play around with SmallC
for CP/M-86 which is the basics of basics.
Still it didn't stop me from writing a little
Graphical Bouncy Ball demo! ;-)
Cheers.
CP/M User.
CP/M User
December 20th, 2003, 09:03 PM
"norayr" wrote in message:
> So, I tell in one topic, that TP 3.0 makes
> a slow and unfaily big code.
> To prove my words I made some tests.
> Tried a simple mathematical function in
> a for... to... cycle 1966050 times.
Why so many times?
> First of all, Pascal 3.0 did not understand
> neither longint nor word variables.
Yeah, so you know TP 3 doesn't support them, yet
you insist on doing a for.. to.. loop 1966050
times! Sounds kinda cheeky to me, since you know
that.
While TP 3 doesn't understand longints, it's
possible though the use of extra routines.
There's two examples I know of for TP 3, both
work on 16bit platforms. The more advanced of
the two is toadlong.zip found at the Simtel
archives (if they still have that stuff). The
second & harder to find is program is simply
called longint.pas, which is found in the
bix02.zip archive at:
http://files.chatnfiles.com/carousel/005A/
unfortunately, they work differently from the
longint found in the later versions of TP.
TOADLONG.ZIP seems to be the better as it
focuses more into the calculations of
longints & is also quite quick at what it does,
thanks to the large amount of effort put into
the quality of the programming.
> So I must use integer value that can't be
> more than 65535.
> I used 30 cycles in one program, that is
> 1966050 times.
That's all very well if you need that sort of
figures to work with, I dare say that even
later versions of TP would be struggling with
that even though it has longint.
TP 3 doesn't handle numbers up to 65535 (
unless you use reals!), so while you cannot
do for example:
var count : word;
begin
for count:=0 to 65535 do
writeln(count);
end.
in TP 3 you can do this:
var count : integer;
count2: real;
begin
for count:=-32767 to 32767 do
begin
count2:=count2+1;
writeln(count2:5:0);
end;
end.
;-)
> So, code generated by Pascal 3.02 is
> about 13.7 kb.
> Code generated with Pascal 5.5 was
> only 2.4 kb.
It's a consequence people have to live with
when working with CP/M. There's also
another website which deals in looking into
the TP 3 compiler called Turbo Pascal 3.0
compiler/code generation internals.
Unfortunately, I don't have the URL. One of
the interesting things it discusses is how
Turbo Pascal 3 doesn't have an optimiser.
Though, I'm unsure if it's implying that
none of the TP 3 compilers do or not.
The big COM file (like I said earlier) comes
from all of the routines it includes.
This is because TP 3 & lower don't use
library routines like crt or dos, instead
it's all in one file (which is this main
program!).
TP 5.5 I know must optimise in some shape
or form, since it only includes routines
which the program needs & is another of
TP 3's limitations.
> Then...
> Speed, and code optimisation.
> TP 3.02 geterated binary worked about 10
> seconds, a little less than 11 secs.
> Tp 5.5 generated code works less than one
> second.
Well I won't know too much about that,
since I don't spend too much time, comparing
which compiler is quicker. TP 3 was designed
so it would be a quick one pass compiler &
it's certainally quicker than lots of the
other CP/M languages, which can take minutes
to compile for some quite bigger code.
> By the way, Tp 7.1 generated binary works
> even less than code generated with TP 5.5
Basically, it's always been about how quick
the compiler works, since that was their
main focus in TP 3 & even earlier I shall
imagine, so they always looked to compile
things quicker. To me it's no big deal, so
to me, it would have been nicer if that had
an optimiser (particularly for TP 3).
> That's all.
> Interesting to read CP/M User's comments
> :)
Yes, well I'll just end by saying that I've
recently had a speed breakthru with one of
my graphical routines on my ol' Z80 (at
4Mhz!). Since I've written a program which
writes hundreds of results (from this
original graphical program) to a file (as a
large array ready for compiling in TP3),
instead of the program taking around a
1:18secs to complete, since providing the
results & using an array, has changed it
remarkibly to just 7-8 secs to complete!
So it just goes to show that if you use the
better things from TP 3, it will show
incredible results. Unfortunately, I won't
be able to show you on an IBM, unless you
download an Amstrad emulator & a copy of
Turbo Pascal (or even CP/M 2.2 & send you
the .COM file!).
Cheers,
CP/M User.
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.