The speed of a phone depend on processor and Ram.
Faster CPU results into speedier operations. By operations, I mean the speed of opening apps, the speed with which a click responds and other things.
More RAM results into better multitasking. Frequently used apps and app data is stored into RAM.