CTTI is Exponential, RTTI is Linear

3 pointsposted 7 hours ago
by thunderbong

1 Comments

HelloNurse

5 hours ago

Behind the article's dichotomy of CTTI and RTTI there is the catalogue of concrete features (e.g. printf-like string formatting) and the respective algorithms with an exponential or linear cost in the number of types. The choice between optimized but polymorphic and lean but indirect implementations and the choice to do the work statically at compile time, dynamically at run time, or never are more independent than the article suggests, and the constraints more complex. For example, the known types at compile time that need to be handled could be all important, or an infinite (sometimes merely impractically huge) superset of the types that are actually used for a certain input, or anything in between.