3 ms·
I've seen very little RTTI, but I've seen it. There are a large number of programmers who use C++ "because it's fast," and they've heard RTTI and exceptions (a
by maxlybbert 10y ago
I've seen very little RTTI, but I've seen it.
There are a large number of programmers who use C++ "because it's fast," and they've heard RTTI and exceptions (and virtual function calls, ...) are slow, so they avoid those features.
But the common implementations for RTTI and exceptions have improved. They're much faster than they used to be. The performance problem isn't that they're slow, but that their performance is unpredictable. Not terribly unpredictable, but unpredictable enough to rule them out in real time code.
But for most everyone else, they're plenty fast. Or, put another way, if RTTI and exceptions make your project noticeably slower, you're doing too many dynamic_casts and/or throwing too many exceptions.
At this point the question should be "does this lead to a good design?" and not "does my gut think it's fast enough?"