Bear in mind that if you're calculating distance for comparative purposes (for example, you only want to find the shortest or longest distance in a set) and you don't need to know the exact distance itself, you can save time by skipping the square root and only comparing the sum of the squares...