home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / compiler / 1361 < prev    next >
Encoding:
Text File  |  1992-08-12  |  2.8 KB  |  70 lines

  1. Newsgroups: comp.compilers,comp.lang.basic
  2. Path: sparky!uunet!think.com!spdcc!iecc!compilers-sender
  3. From: macrakis@osf.org (Stavros Macrakis)
  4. Subject: Re: Why is compiled basic slower than C? (Basic is the future)
  5. Reply-To: macrakis@osf.org (Stavros Macrakis)
  6. Organization: OSF Research Institute
  7. Date: Wed, 12 Aug 1992 22:54:07 GMT
  8. Approved: compilers@iecc.cambridge.ma.us
  9. Message-ID: <92-08-060@comp.compilers>
  10. References: <92-08-042@comp.compilers>
  11. Keywords: C, Basic, performance
  12. Sender: compilers-sender@iecc.cambridge.ma.us
  13. Lines: 55
  14.  
  15. Glenn_Johansson@f313.n203.z2.fidonet.cd.chalmers.se writes:
  16.  
  17. [How much slower is compiled Basic than C, any why?]
  18.  
  19. Here are some thoughts.  Warning: I have not looked at Basic in some
  20. years.
  21.  
  22.    2. Why is the basic compilers creating a slower product than the C
  23.    compilers?
  24.  
  25.       Possible answers
  26.       a. Because of the beginner-reputation of basic,
  27.      basic programmers write more bad code than for example C programmers,
  28.      because "serious" programmers quickly change to C.
  29.  
  30. In the PC world, many implementations were interpreters, so this may have
  31. given Basic a bad reputation for speed.  This also lowers expectations for
  32. compilers. Of course, the original Dartmouth Basic was compiled.
  33.  
  34.      c. Because it is much harder to write a compiler for basic (even modern
  35.         basic) than for C, which is designed for the purpose of being
  36.     compiled, not for the programmers.
  37.  
  38. This is part of it, no doubt.  It also depends what you are doing.  I
  39. would expect a good Basic compiler to be comparable to C for straight
  40. floating-point code.  Old Basics used floating-point for ALL arithmetic,
  41. so integer code will be much slower.  String manipulation will be slower,
  42. since Basic's facilities are higher-level.
  43.  
  44.    ...So why is not Basic the biggest programming language today?
  45.    Well, my theory is this: When C was invented, it was made to be
  46.    simple to write a compiler for, because the compiler constructors
  47.    were not that good then.
  48.  
  49. Yes, this is certainly true.  In fact, large areas of C's semantics (if
  50. you can dignify them with that name) are defined by what is easy to
  51. implement, not what makes sense.
  52.  
  53. C is also a lower-level language.  C doesn't really `understand' strings,
  54. only pointers to byte positions.  So it is possible to write lower-level
  55. code.  It is also possible to write high-level code to a certain extent,
  56. but it requires discipline.
  57.  
  58.    [....  By the way, the guys who wrote Basic in
  59.    the first place definitely wanted it to be easy to compile -- the
  60.    first compiler at Dartmouth compiled so fast it was hard to measure
  61.    its speed. -John]
  62.  
  63. Basic was certainly designed to be easy to compile, but not
  64. necessarily to be fast to run.
  65.  
  66.     -s
  67. -- 
  68. Send compilers articles to compilers@iecc.cambridge.ma.us or
  69. {ima | spdcc | world}!iecc!compilers.  Meta-mail to compilers-request.
  70.