Comp Sci: code motion

Tutoring computer science, its own terms arise. The tutor mentions code motion.

Code motion refers to evaluating a sentry value once, outside a loop, then storing the value in a variable which will be used for the test in the loop. Not using code motion would be evaluating the expression each time the loop is iterated.

Code motion is done to achieve higher efficiency.


Bryant, Randal E. and David R. O’Hallaron.Computer Systems: A Programmer’s Perspective, third ed. Toronto: Pearson, 2016.

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Leave a Reply