&#62; import java.util.Calendar;<p>might be your first clue...<p>&#62; but a tight inner loop with a function call is begging for an inline.<p>The loop body makes several other function calls, you would be very hard pressed to measure the difference.  And if it was a C function in a larger project, you probably wouldn't want to inline it because that would slow your compile times and cause you to lose modularity (i.e. you'd have to rebuild all client code rather than just update the DSO when you optimize the distance function).  This function does enough work that it doesn't deserve to be inlined.