The i5 8400 boosts to 3.8ghz under heavy loads on all cores.
Take the ipc increase imto account from haswell to kaby lake & thats the equivalent of 4.1ghz on the i3 4170.
& thats not even taking into consideration the i5 has 3 x the number of physical cores & the newer platform runs much faster ram speeds