Use fast version for D
Use fast version for D

Apply fast version and move `dist` function to where it is used.
logicchains/LPATHBench,def-/LPATHBench,def-/LPATHBench,def-/LPATHBench,logicchains/LPATHBench,logicchains/LPATHBench,logicchains/LPATHBench,def-/LPATHBench,logicchains/LPATHBench,logicchains/LPATHBench,logicchains/LPATHBench,def-/LPATHBench,def-/LPATHBench,def-/LPATHBench,def-/LPATHBench,def-/LPATHBench,logicchains/LPATHBench,logicchains/LPATHBench,def-/LPATHBench,logicchains/LPATHBench,logicchains/LPATHBench,logicchains/LPATHBench,logicchains/LPATHBench,logicchains/LPATHBench,def-/LPATHBench,def-/LPATHBench,def-/LPATHBench,logicchains/LPATHBench