Previous | Next --- Slide 57 of 75
Back to Lecture Thumbnails

Can the compiler do this automatically and decide whether or not "X=1" can be removed based on if X is a local variable, or if it is possible for a reference to X to "escape" to another thread?


On that note, I wonder whether optimizations done by compilers such as loop optimizations can change the execution code such that the code actually slows down due to inefficient use of cache.


In the left version of the code, is it still possible that the output can be "1111111111111..." (no zeros) instead of "111111011111111..."?

Please log in to leave a comment.