home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / compiler / 1350 < prev    next >
Encoding:
Internet Message Format  |  1992-08-12  |  2.2 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!usenet.coe.montana.edu!news.u.washington.edu!ogicse!das-news.harvard.edu!spdcc!iecc!compilers-sender
  2. From: jch@rdg.dec.com (John Haxby)
  3. Newsgroups: comp.compilers,comp.lang.basic
  4. Subject: Re: Why is compiled basic slower than C? (Basic is the future)
  5. Keywords: Basic, C, performance
  6. Message-ID: <92-08-049@comp.compilers>
  7. Date: 12 Aug 92 08:43:32 GMT
  8. References: <92-08-042@comp.compilers>
  9. Sender: compilers-sender@iecc.cambridge.ma.us
  10. Reply-To: jch@rdg.dec.com (John Haxby)
  11. Organization: Digital Equipment Corporation
  12. Lines: 32
  13. Approved: compilers@iecc.cambridge.ma.us
  14.  
  15. Glenn_Johansson@f313.n203.z2.fidonet.cd.chalmers.se writes:
  16. |> [How much slower is compiled Basic than C, and why?]
  17.  
  18. There has been a lot of work put into optimizing C compilers: the efforts
  19. of FSF, Sun and MIPSCO to mention but three.  There hasn't been a great
  20. deal of work put into optimizing BASIC compilers, at least not that I know
  21. of.
  22.  
  23. There seems to be a more general problem though: compilers of high-level
  24. languages tends to produce optimal machine code, whereas compilers of
  25. low-level languages tend to produce sub-optimal machine code.
  26.  
  27. Some time ago, code produced by an Algol68S compiler was compared to code
  28. produced by an optimizing Fortran compiler on an ICL1906.  The program
  29. compiled from Algol68 ran 30% faster than that produced from the Fortran
  30. compiler.  The reason for this seems to be that the high-level language
  31. compiler has a better idea of what the programmer is trying to do and can
  32. make appropriate optimizations-- such optimizations frequently show up as
  33. doing nothing at all where another programming language would require code
  34. to be executed, or use a single machine instruction for coping where (C
  35. for example), would use a loop.  This form of optimization, of course, is
  36. largely wasted on RISC machines, although the compiler can still exercise
  37. the right to copy, say, 4 bytes at a time whereas the C program forces a
  38. byte by byte copy.
  39.  
  40. -- 
  41. John Haxby
  42. Digital                <jch@rdg.dec.com>
  43. Reading, England        <...!uknet!wessex!jch>
  44. -- 
  45. Send compilers articles to compilers@iecc.cambridge.ma.us or
  46. {ima | spdcc | world}!iecc!compilers.  Meta-mail to compilers-request.
  47.