Disadvantages & Advantages of Compilers

Techwalla may earn compensation through affiliate links in this story. Learn more about our affiliate and product review process here.
Programmers use compilers to turn source code into machine code.

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.

Advertisement

Advantage: Self-Contained and Efficient

Video of the Day

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 has to 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.

Advertisement

Video of the Day

Disadvantage: Hardware Specific

Because a compiler translates source code into a specific machine language, programs have to 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.

Advertisement

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.

Advertisement

Advertisement

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 in order to test functionality and troubleshoot glitches.

Advertisement

Advertisement

references

Report an Issue

screenshot of the current page

Screenshot loading...