Re: Why is compiled basic slower than C

Diomidis Spinellis <dds@doc.imperial.ac.uk>
Wed, 12 Aug 1992 12:12:03 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 dds@doc.imperial.ac.uk (Diomidis Spinellis) (1992-08-12)
| List of all articles for this month |
Newsgroups: comp.compilers
From: Diomidis Spinellis <dds@doc.imperial.ac.uk>
Organization: Compilers Central
Date: Wed, 12 Aug 1992 12:12:03 GMT
Keywords: Basic, C, performance
References: 92-08-042

BASIC has many features that are inherently slow. Comparable programs
written in C do not rely on such features, and therefore, generate faster
code. The most important features of BASIC that result to slow code are:


1. All numeric computations are done in floating point by default.
      One must explicitly name a variable with a special integer suffix
      code, to declare it as an integer.


2. String operations rely on the dynamic memory allocation and
      garbage collection. Both are slower than the staticaly
      allocated string memory / programer controlled allocation and
      disposal schemes that C programmers use.




Furthermore, in PC environments, C programs often directly control the
hardware of the output devices (e.g. screen) by using pointers to the
memory associated with them (e.g. screen buffer). The same operation can
be expressed in BASIC only in a more roundabout way (usualy through a POKE
operation) and will therefore be slower.


Diomidis
--
Diomidis Spinellis Internet: <dds@doc.ic.ac.uk> UUCP: ...!uknet!icdoc!dds
Department of Computing, Imperial College, London SW7
--


Post a followup to this message

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