The reaction proceeds via SN2 mechanism. It is a unimolecular nucleophilic substitution reaction. The reaction is hence favoured in the presence of a polar aprotic solvent. DMF is a polar aprotic solvent. So, the reaction is the fastest with DMF solvent.