home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.compilers
- Path: sparky!uunet!think.com!spdcc!iecc!compilers-sender
- From: Diomidis Spinellis <dds@doc.imperial.ac.uk>
- Subject: Re: Why is compiled basic slower than C
- Reply-To: Diomidis Spinellis <dds@doc.imperial.ac.uk>
- Organization: Compilers Central
- Date: Wed, 12 Aug 1992 12:12:03 GMT
- Approved: compilers@iecc.cambridge.ma.us
- Message-ID: <92-08-053@comp.compilers>
- Keywords: Basic, C, performance
- References: <92-08-042@comp.compilers>
- Sender: compilers-sender@iecc.cambridge.ma.us
- Lines: 27
-
- 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
- --
- Send compilers articles to compilers@iecc.cambridge.ma.us or
- {ima | spdcc | world}!iecc!compilers. Meta-mail to compilers-request.
-