Which machine is a better choice for running VM, virtual labs, coding & studying?
Aside from the CPUs, there are several attributes of the laptop models themselves (size, weight, shape, screen, keyboard, etc.) that you will need to personally weigh into your decision. I can't objectively say which machine is better for you, but at least we can objectively compare the CPUs in question.
According to user-submitted benchmarks, the i7-3520M is only 10% faster than the i5-5300U on average.
The i7-3520M CPU was a high-end CPU from 2013 intended for gaming laptops and mobile workstations when it released. In 2013 it would have been one of the best choices for your kind of workload.
I read that the U series of CPUs are sluggish comparing with the M series.
The i5-5300U CPU is a low-power CPU from 2015 intended for ultra portable (thin & light) laptops that allows long battery life. In 2015 this CPU would not have been suitable for your workload compared to the i7 'M' models available at the time.
That doesn't mean that all 'U' CPUs are worse than all 'M' CPUs though. The age difference between these two CPUs has allowed Intel to close the gap through architectural improvements. If you were to look at a current-gen 'U' CPUs from 2019, you may find one that is faster than the i7-3520M!
The i5-5300U being a newer CPU gives you some advantages over the i7-3520M that are worth trading the 10% advantage for:
- Support for AVX2, SSE 4.1, SSE 4.2
These instruction sets allow massive performance gains for SIMD type operations.
(i.e. Crunching lots of data in parallel)
- 14nm Lithography
Moving from 22nm to 14nm allows Intel to use less power to accomplish the same functionality, so when the CPU isn't working hard it is using significantly less power (and outputting less heat) to run the operating system and background tasks.
- Better Integrated Graphics
The HD5500 Graphics are about 40% faster than the HD4000 Graphics.
If none of the points above appeal to you, then the i7-3520M is still a faster CPU in terms of raw performance.