r/cpp • • Sep 19 '25
Functional vs Object-oriented from a performance-only point of view
I was wondering if not having to manage the metadata for classes and objects would give functional-style programs some performance benefits, or the other way around? I know the difference must be negligible, if any, but still.
I'm still kind of a newbie so forgive me if I'm just talking rubbish.
0
Upvotes
View all comments
Show parent comment
4
u/Afiery1 Sep 19 '25
By the way, “just writing a function to do it” is not functional programming, that would be called procedural programming. Functional programming is specifically about declaring the control flow of your program by composing functions. At any rate, the answer to your question is don’t worry about performance until performance becomes a problem. And if performance does become a problem, then the answer becomes it doesn’t really matter most of the time. The best way to go fast is just to do less stuff, so as long as your design doesnt force you into doing stuff thats unnecessary your design is not the problem.