Choosing a Programming Language
Throughout this book we use a variety of programming languages to illustrate the algorithms. No single language is the right one to use in all circumstances. Too often, a specific programming language is used simply because it was used on a similar project. Since you are interested in algorithms, it is likely that you also want to ensure that your implementations run as fast as possible. This level of fine-tuning or optimization is beyond the scope of this book, though we describe several instances where carefully designed code optimizations result in impressive performance benefits. Choosing a language often depends on a number of factors:
- Garbage collection versus manual memory allocation
In the previous section we described low-level details about the way information is stored as a C program executes. Using the standard memory allocation packages available, most C programmers are used to allocating memory as needed, and freeing it when done. An alternative approach is to use a language such as Java or Scheme that provides built-in garbage collection to manage allocated memory. Garbage collection technology is increasingly efficient, and there are existing packages available to enable even C programs to integrate garbage collection with the default memory allocation schemes.
- Bytecode interpretation versus compiled code
The common perception is that compiled code will outperform interpreted code every time. In Java, for example, the Java compiler ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access