home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.compilers,comp.lang.basic
- Path: sparky!uunet!think.com!spdcc!iecc!compilers-sender
- From: macrakis@osf.org (Stavros Macrakis)
- Subject: Re: Why is compiled basic slower than C? (Basic is the future)
- Reply-To: macrakis@osf.org (Stavros Macrakis)
- Organization: OSF Research Institute
- Date: Wed, 12 Aug 1992 22:54:07 GMT
- Approved: compilers@iecc.cambridge.ma.us
- Message-ID: <92-08-060@comp.compilers>
- References: <92-08-042@comp.compilers>
- Keywords: C, Basic, performance
- Sender: compilers-sender@iecc.cambridge.ma.us
- Lines: 55
-
- 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
- --
- Send compilers articles to compilers@iecc.cambridge.ma.us or
- {ima | spdcc | world}!iecc!compilers. Meta-mail to compilers-request.
-