Given an input and a program when can you derive the output faster than just running the program?
Here's an example:

for i from 1 to 10000000000
  do nothing
end for
output 1


In general, however, you can't save much. Indeed, the time hierarchy theorem states, roughly speaking, that you cannot simulate a $T(n)$-time Turing machine running in time $o(T(n)/\log T(n))$.