Re: Why is compiled basic slower than C? (Basic is the future)

macrakis@osf.org (Stavros Macrakis)
Wed, 12 Aug 1992 22:54:07 GMT

          From comp.compilers

Related articles
Why is compiled basic slower than C? (Basic is the future) Glenn_Johansson@f313.n203.z2.fidonet.cd.chalmers.s (1992-08-11)
Re: Why is compiled basic slower than C? (Basic is the future) jch@rdg.dec.com (1992-08-12)
Re: Why is compiled basic slower than C? (Basic is the future) hywang@apple.com (Hao-yang Wang) (1992-08-12)
Re: Why is compiled basic slower than C? (Basic is the future) maniattb@cs.rpi.edu (1992-08-12)
Re: Why is compiled basic slower than C? (Basic is the future) macrakis@osf.org (1992-08-12)
Re: Why is compiled basic slower than C? (Basic is the future) scott@bbx.basis.com (1992-08-13)
Re: Why is compiled basic slower than C? (Basic is the future) macrakis@osf.org (1992-08-14)
Re: Why is compiled basic slower than C? (Basic is the future) burley@geech.gnu.ai.mit.edu (1992-08-14)
Re: Why is compiled basic slower than C? (Basic is the future) dbenn@leven.appcomp.utas.edu.au (1992-08-15)
Re: Why is compiled basic slower than C? (Basic is the future) pardo@cs.washington.edu (1992-08-15)
Re: Why is compiled basic slower than C? (Basic is the future) macrakis@osf.org (1992-08-17)
[6 later articles]
| List of all articles for this month |
Newsgroups: comp.compilers,comp.lang.basic
From: macrakis@osf.org (Stavros Macrakis)
Organization: OSF Research Institute
Date: Wed, 12 Aug 1992 22:54:07 GMT
References: 92-08-042
Keywords: C, Basic, performance

Glenn_Johansson@f313.n203.z2.fidonet.cd.chalmers.se writes:


[How much slower is compiled Basic than C, any why?]


Here are some thoughts. Warning: I have not looked at Basic in some
years.


      2. Why is the basic compilers creating a slower product than the C
      compilers?


            Possible answers
            a. Because of the beginner-reputation of basic,
basic programmers write more bad code than for example C programmers,
because "serious" programmers quickly change to C.


In the PC world, many implementations were interpreters, so this may have
given Basic a bad reputation for speed. This also lowers expectations for
compilers. Of course, the original Dartmouth Basic was compiled.


          c. Because it is much harder to write a compiler for basic (even modern
                basic) than for C, which is designed for the purpose of being
compiled, not for the programmers.


This is part of it, no doubt. It also depends what you are doing. I
would expect a good Basic compiler to be comparable to C for straight
floating-point code. Old Basics used floating-point for ALL arithmetic,
so integer code will be much slower. String manipulation will be slower,
since Basic's facilities are higher-level.


      ...So why is not Basic the biggest programming language today?
      Well, my theory is this: When C was invented, it was made to be
      simple to write a compiler for, because the compiler constructors
      were not that good then.


Yes, this is certainly true. In fact, large areas of C's semantics (if
you can dignify them with that name) are defined by what is easy to
implement, not what makes sense.


C is also a lower-level language. C doesn't really `understand' strings,
only pointers to byte positions. So it is possible to write lower-level
code. It is also possible to write high-level code to a certain extent,
but it requires discipline.


      [.... By the way, the guys who wrote Basic in
      the first place definitely wanted it to be easy to compile -- the
      first compiler at Dartmouth compiled so fast it was hard to measure
      its speed. -John]


Basic was certainly designed to be easy to compile, but not
necessarily to be fast to run.


-s
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.