Saturday, May 9, 2009

C compiler?

what is a non-optimizing compiler?

C compiler?
"If the compiler is an optimizing compiler, one of these stages "optimizes" the machine language code so that it either takes less time to run or occupies less memory or sometimes both. "





"A non-optimizing compiler will generate code to multiply 45 by 88 and store the value in x. An optimizing compiler will detect that both 45 and 88 are constants, so their product will also be a constant. Hence it will find 45 * 88 = 3960 and generate code that simply copies 3960 into x. "





Source: http://linuxgazette.net/issue71/joshi.ht...
Reply:Compilers take your high level language code and break it down to machine language. During this process there are many opportunities to change what you've coded to make it run faster without changing the overall result. One easy instance of this would be making a one line block with an if statement in-line. A more complex example is taking a tail-recursive function and making it iterative. The point is, a 'non-optimizing' compiler doesn't attempt to make these changes, leaving your code as fat and slow as you'd like.





Cheers.


No comments:

Post a Comment