resolution is also a big factor in how the cpu does. tom's did a comparison recently and saw a dual core pentium keeping up with an i7 at 4k. gpu is so bogged down at that resolution that the dual core keeps it fed easily.
but obviously at 1080p, the gpu can do more and the dual core quickly shows it weakness as the i7 pulled away by a very long shot. so lot's more to consider than just cpu itself. what resolutions? gpu paired with it? specific game being played? and so on and so on.
the i3 is a solid all around choice and won't leave you begging for more on most games. if that's good enough for you, then it's all yu need to buy. if you want to push everything to the max and never compromise on anything, then the most cpu power you can afford is the way to go and makes the i5 a better idea.
also depends on what else you do with the pc. multi-tasking and running a ton of stuff at once needs more resources and the i7 would do it a lot better than either. streaming, encoding and content creation likes the extra threads as well. so more to consider than just gaming unless that's all you do.
an i3 is a dual core cpu with hyperthreading which utilizes the 2 cores better. an i5 is 4 actual cores which does a bit more overall since it is has more physical resources to work with. an i7 is an i5 with hyperthreading utilizing the 4 cores to the max the same way an i3 uses it's dual cores to the fullest. hence the performance gain of an i7 over an i5. same 4 cores just better utilized.