Turbo Pascal quobbles!

19 views
Skip to first unread message

Ross Simpson

unread,
Nov 11, 2003, 1:44:39 AM11/11/03
to
Hi folks, I must warn you, this is a Dear oh Dear thread - or rant, if
you don't wish to read on, stop reading now.

I must say, I'm very disappointed with Turbo Pascal on the Amstrad. I've
written around 3 programs now, which clearly demonstrate it's downfalls
when up against the Amstrad's Standard interpreted BASIC.

I wrote a simple BASIC program, which counts from 0 to 100 & displays
the cosine of that (this was 1 figure stuff with 9 decimal placings),
this test took 6secs to do in Locomotive BASIC. An equivalant Turbo
Pascal program took 11Secs. I modified my TP program so it would only
display 5 decimal spots, but still took 9secs! :-(

I'll have one last test to do with this TP & if I see no improvement,
then I'm kicking in on this system because it just seems to be crazy to
have a compiler been beaten by an interpreted language.

If anyone wants a report on this language done for their fanzine, let me
know & I'll put in my 2 cents!

Cheers,
Ross.


MrJumbles

unread,
Nov 11, 2003, 3:51:37 AM11/11/03
to
<lurk mode off>
seems a bit odd...
maybe the pascal compiler is no good at floating point
how does it benchmark using integer variables only..ie..
basic.
10 int a,b
20 for a=1 to 1000000
25 b=b+1
30 next

pascal.
var
a,b : integer;
for a:=1 to 1000000 do
begin
b:=b+1;
end;

"Ross Simpson" <Hi_Mr_...@nowhere.com.au> wrote in message
news:3fb085b6$0$9403$afc3...@news.optusnet.com.au...

regis

unread,
Nov 11, 2003, 8:11:59 AM11/11/03
to
MrJumbles a écrit :
> <lurk mode off>

> 10 int a,b
> 20 for a=1 to 1000000
> 25 b=b+1
> 30 next
>
> pascal.
> var
> a,b : integer;
> for a:=1 to 1000000 do
> begin
> b:=b+1;
> end;
>

Oups !
If a and b are integers, you have -32768=<a=<32767, i guess...

Régis

Ross Simpson

unread,
Nov 12, 2003, 12:24:44 AM11/12/03
to
"MrJumbles" wrote in message...

> <lurk mode off>
> seems a bit odd...
> maybe the pascal compiler is no good at floating point
> how does it benchmark using integer variables only..ie..

Actually in Turbo Pascal, isn't too bad, in Locomotive BASIC it's
actually slower, unless 'defint c' (c for count) there, in which case
is the same speed as TP.

> basic.
> 10 int a,b
> 20 for a=1 to 1000000
> 25 b=b+1
> 30 next

> pascal.
> var
> a,b : integer;
> for a:=1 to 1000000 do
> begin
> b:=b+1;
> end;

I've reworked on one of my programs, by rewriting the loop & working
out (as an integer) how many time .2 goes into 125.8, which returned
629 times. From there I used a for loop (with count :=0 to 629), but
it hasn't made a difference. I can only image that the sin & cos in
Pascal is taking more time to calculate the result (maybe not a lot of
time difference), but because of it takes 629 steps to complete the
program, it all blows out time.

Cheers,
Ross.

CP/M User

unread,
Feb 29, 2020, 3:58:19 PM2/29/20
to
The trouble with Turbo Pascal has to do with the COS() and SIN() functions taking more time to return the result. Locomotive BASIC by comaparision has a table assigned to it which allows figures from COS() and SIN() to be obtained.

The only way to work around that in Turbo Pascal is to generate a file or process the information into an Array with the information stored, which changes the result consideribly.
Reply all
Reply to author
Forward
0 new messages