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

  1. Newsgroups: comp.compilers
  2. Path: sparky!uunet!think.com!spdcc!iecc!compilers-sender
  3. From: Diomidis Spinellis <dds@doc.imperial.ac.uk>
  4. Subject: Re: Why is compiled basic slower than C
  5. Reply-To: Diomidis Spinellis <dds@doc.imperial.ac.uk>
  6. Organization: Compilers Central
  7. Date: Wed, 12 Aug 1992 12:12:03 GMT
  8. Approved: compilers@iecc.cambridge.ma.us
  9. Message-ID: <92-08-053@comp.compilers>
  10. Keywords: Basic, C, performance
  11. References:  <92-08-042@comp.compilers>
  12. Sender: compilers-sender@iecc.cambridge.ma.us
  13. Lines: 27
  14.  
  15. BASIC has many features that are inherently slow.  Comparable programs
  16. written in C do not rely on such features, and therefore, generate faster
  17. code.  The most important features of BASIC that result to slow code are:
  18.  
  19. 1. All numeric computations are done in floating point by default.
  20.    One must explicitly name a variable with a special integer suffix
  21.    code, to declare it as an integer.
  22.  
  23. 2. String operations rely on the dynamic memory allocation and
  24.    garbage collection.  Both are slower than the staticaly
  25.    allocated string memory / programer controlled allocation and
  26.    disposal schemes that C programmers use.
  27.  
  28.  
  29. Furthermore, in PC environments, C programs often directly control the
  30. hardware of the output devices (e.g. screen) by using pointers to the
  31. memory associated with them (e.g. screen buffer).  The same operation can
  32. be expressed in BASIC only in a more roundabout way (usualy through a POKE
  33. operation) and will therefore be slower.
  34.  
  35. Diomidis
  36. --
  37. Diomidis Spinellis    Internet: <dds@doc.ic.ac.uk>  UUCP: ...!uknet!icdoc!dds
  38. Department of Computing, Imperial College, London SW7
  39. -- 
  40. Send compilers articles to compilers@iecc.cambridge.ma.us or
  41. {ima | spdcc | world}!iecc!compilers.  Meta-mail to compilers-request.
  42.