Showing posts with label Compiler. Show all posts
Showing posts with label Compiler. Show all posts

Thursday, 28 June 2018

Advantages & Disadvantages of Compilers

Computers read commands from a machine language written in binary, i.e., long strings of zeros and ones. While computers can read this language efficiently, most human programmers cannot. That is why programmers work in a programming language they can understand, which they then translate to the machine language the computer can understand. While many newer languages use interpreters that translate from one to the other as the program runs, older programming languages used compilers that did this translation entirely before the computer executed the program.
Compiler

Advantage: Self-Contained and Efficient
One major advantage of programs that are compiled is that they are self-contained units that are ready to be executed. Because they are already compiled into machine language binaries, there is no second application or package that the user should keep up-to-date. If a program is compiled for Windows on an x86 architecture, the end-user needs only a Windows operating system running on an x86 architecture. Additionally, a precompiled package can run faster than an interpreter compiling source code in real-time.

Disadvantage: Hardware Specific
Because a compiler translates source code into a specific machine language, programs should be specifically compiled for OS X, Windows or Linux, as well as specifically for 32-bit or 64-bit architectures. For a programmer or software company trying to get a product out to the widest possible audience, this means maintaining multiple versions of the source code for the same application. This results in more time spent on source code maintenance and extra trouble when updates are released.

Advantage: Hardware Optimization
While being locked into a specific hardware package has its downsides, compiling a program can also increase its performance. Users can send specific options to compilers regarding the details of the hardware the program will be running on. This allows the compiler to create machine language code that makes the most efficient use of the specified hardware, as opposed to more generic code. This also allows advanced users to optimize a program's performance on their computers.

Disadvantage: Compile Times
One of the drawbacks of having a compiler is that it must actually compile source code. While the small programs that many novice programmers code take trivial amounts of time to compile, larger application suites can take significant amounts of time to compile. When programmers have nothing to do but wait for the compiler to finish, this time can add up—especially during the development stage, when the code has to be compiled to test functionality and troubleshoot glitches.