Depends on the aplication, if it uses more than 4 cores then the FX will perform better, but there are almost no apps that will use more than 4 cores, so in most cases the i5 will perform better.
And for gaming the i5 is far better. The difference between those i5 cpus is that one is unlocked (4670k) and the other not (4590), at stock clock rates the performance is almost the same, but you can overclock the 4670k and get better performance of it. Remember that if you plan to overclock that 4670k, you must also get a z series motherboard.