Fast distance and dimension