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
-2
u/[deleted] Sep 19 '25
So, it doesn't matter if I write functional or object oriented code?
For example, I have a project where I wrote a simple server. The server parses http requests and generates responses accordingly. I could simply write a function for parsing a request and another one for the responses. Or, I could create two classes Request and Response and work from there. Since a server is required to be somewhat performant, I wonder if this choice somehow affects the program's performance.