Skip to content
Discussion options

You must be logged in to vote

Hi @kaixiongg, thanks for asking. It's a great one!

There is currently no benchmark comparing proxy with CRTP, because CRTP is not a type-erasure technique. While CRTP enables polymorphic behavior at compile time, it doesn't abstract away concrete types at runtime. This means CRTP can't manage the lifetime of heterogeneous objects in a unified way, which is a core capability of type-erasure. So discussing lifetime management performance in the context of CRTP is not meaningful.

Regarding invocation performance, CRTP typically results in direct function calls that the compiler can inline, making them very efficient. In contrast, proxy introduces an additional layer of indirection due to it…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mingxwa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants