I really don't think there's a "performance" difference between these two "methods"."
Anyway, it seems you're doing sequential coding, I'm not saying you shouldn't, but if you're trying to learn you maybe look into
Object-oriented programming and
Multitier architecture
That might be a good start.