(This is the older material - click here - for current specification content)

14. Comparing Compiler & Interpreter

Compare
COMPILER INTERPRETER
Fast, creates executable file that runs directly on the CPU

Slower, interprets code one line at a time

Debugging is more difficult. One error can produce many spurious errors

Debugging is easier. Each line of code is analysed and checked before being executed

 

More likely to crash the computer. The machine code is running directly on the CPU

Less likely to crash as the instructions are being carried out either on the interpreters' command line or within a virtual machine environment which is protecting the computer from being directly accessed by the code.

Easier to protect Intellectual Property as the machine code is difficult to understand

Weaker Intellectual property as the source code (or bytecode) has to be available at run time. For example if you write a Flash Actionscript application, you can easily get de-compilers that convert the p-code back into actionscript source code (unless you use encryption, but that is another story).

Uses more memory - all the execution code needs to be loaded into memory, although tricks like Dynamic Link Libraries lessen this problem Uses less memory, source code only has to be present one line at a time in memory
Unauthorised modification to the code more difficult. The executable is in the form of machine code. So it is difficult to understand program flow. Easier to modify as the instructions are at a high level and so the program flow is easier to understand and modify.
 

Copyright © www.teach-ict.com