[mod.computers.vax] pascal vs. fortran

sommar@seismo.CSS.GOV@enea.UUCP (02/18/87)

Yes, I have heard that if I you want it to go fast and yet use a high-level
language, use Fortran. Fortran is the fastet language under VMS, they say.

Well, it may be fastest, but it is not the nicest to program in. 
Especially not if you're into system programming. All those %val, %loc
clutters up your code, not talking about the equivalence statements...

Anyway, I have just gone into a real-time project for VMS and currently
they're using Fortran and Macro. What I'd like to know if there is any one
who can give me *facts* on this issue. Are the code produced by the Pascal
compiler really so much slower than the one of the Fortran compiler? 
Especially if you are using all these fancy Fortran-8X features, which 
doesn't to be aimed to make quick programmes.
  If you have facts that are supporting my view, please give me references
so I can convince the other project members.

Erland Sommarskog
ENEA Data, Stockholm, Sweden
sommar@enea.UUCP

JOHNSON@NUHUB.ACS.NORTHEASTERN.EDU.UUCP (02/19/87)

     >Yes, I have heard that if I you want it to go fast
     >and yet use a high-level language, use Fortran.
     >Fortran is the fastet language under VMS, they
     >say. 
     >
     >Well, it may be fastest, but it is not the nicest
     >to program in. Especially not if you're into
     >system programming. All those %val, %loc clutters
     >up your code, not talking about the equivalence
     >statements... 
     >
     >Anyway, I have just gone into a real-time project
     >for VMS and currently they're using Fortran and
     >Macro. What I'd like to know if there is any one
     >who can give me *facts* on this issue. Are the
     >code produced by the Pascal compiler really so
     >much slower than the one of the Fortran compiler?
     >Especially if you are using all these fancy
     >Fortran-8X features, which doesn't to be aimed to
     >make quick programmes.   If you have facts that
     >are supporting my view, please give me references
     >so I can convince the other project members. 
     >
     >Erland Sommarskog
     >ENEA Data, Stockholm, Sweden
     >sommar@enea.UUCP

     Hm . . .  This is a good one.  Comparing different langauges is a 
bit like comparing apples and oranges.  Which language you use depends 
on what you are doing.  In general, Pascal does things behind the curtain 
that you don't see.  The VMS common code generator and optimizer is used 
with Pascal and does a reasonably good job at optimizing this unseen 
stuff.  Fortran, on the other hand (last I heard any way) used it's own 
code generator and optimizer.  The two backends do similar things but 
not EXACTLY the same things.  

     If you used nested structures with lots of pointers in Pascal you 
could easily end up with lots of unseen support code that you wouldn't 
get with the usual vanilla Fortran because Fortran hasn't got all that.
So it also depends on the what code you write.  Something easily written 
is not necessarily easily executed.

     Try writing something simple and get both compilers to show you the 
generated code.  You can also instrument the code with timers but 
remember that timing takes time itself.

     I'm sorry I don't have any numbers for you.  I rarely get time do 
one thing in two different langauges.  Still, if you write vanilla 
Fortran and simplistic Pascal they probably won't be much different in 
terms of speed.

     One last thought.  You also need to consider just how time critical 
is your application.  If it REALLY isn't very time critical then it 
probably doesn't matter which language you use.  I have insufficient 
data for a better answer.

Chris Johnson
Northeastern University

csnet:      johnson@nuhub.acs.northeastern.edu
arpa:       johnson%nuhub.acs.northeastern.edu@relay.cs.net
at&t:       (617) 437-2335