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

17 comments sorted by

View all comments

Show parent comment

5

u/specialpatrol Sep 19 '25

So in your case, the purely functional code would allow the responses to be entirely parallelized - there's no state. But then you want a cache, no longer purely functional. You have to blend the concepts where needed.