What are the disadvantages of using high-level languages?

dunck picture dunck · Nov 6, 2015 · Viewed 16.5k times · Source

I take that the obvious advantages are maintainability, programmer-friendliness etc. but what are the disadvantages?

Is the compiler being put under extra work to convert where it may not be necessary?

Are there situations where low-level languages are better suited to a task because of aforementioned disadvantages?

Answer

M156 picture M156 · Nov 6, 2015

In short: Low Level Languages can yield better performance due to very specific optimizations.

Advantages of Low Level Languages:

  • You can specifically target and utilize chip features (or registers)
  • Generally it can be (a lot) faster if you know what you do, but this is a rare case.

Disadvantages of High Level Languages:

  • You need some sort of compiler to get the HLL to LLL
  • In some cases (e.g. Java / C#) you have an interpreter in between which also consumes resources (but can also optimize itself while running the program!)

Here a more detailed list of Advantages of LLL:

  • you can access machine-dependent registers and I/O
  • you can control the exact code behavior in critical sections that might otherwise involve deadlock between multiple software threads or hardware devices
  • you can break the conventions of your usual compiler, which might allow some optimizations (like temporarily breaking rules about
    memory allocation, threading, calling conventions, etc)
  • you can build interfaces between code fragments using incompatible conventions (e.g. produced by different compilers, or separated by a
    low-level interface)
  • you can get access to unusual programming modes of your processor (e.g. 16 bit mode to interface startup, firmware, or legacy code on
    Intel PCs)
  • you can produce reasonably fast code for tight loops to cope with a bad non-optimizing compiler (but then, there are free optimizing
    compilers available!)
  • you can produce hand-optimized code perfectly tuned for your particular hardware setup, though not to someone else's
  • you can write some code for your new language's optimizing compiler (that is something what very few ones will ever do, and even they not often)
  • i.e. you can be in complete control of your code

Source: http://www.tldp.org/HOWTO/Assembly-HOWTO/x133.html