|
|
In article <3fe1fac3@news.povray.org> , Wolfgang Wieser <wwi### [at] gmxde>
wrote:
>>> So, RTTI and exceptions still introduce considerable overhead even if
>>> not used.
>>
>> Shitty compiler => shitty code! You should really use professional
>> compilers to base your comparisons on. Gcc's main feature is portability,
>> not performance.
>>
> Heeee. gcc is by all means no "shitty compiler". But we may try using
> e.g. the intel compiler (it has -fno-rtti but no -fno-exceptions).
>
> Do you know how RTTI internally works? (I.e. in an "non-shitty"
> compiler.)
It is very simple (of course there are other ways to do it). In essence,
all you need is a single static type_info object for every class. So, you
create one static instance of such an object (ideally you have the linker
fold multiple instances). Every virtual function table gets a pointer to the
type information. For PODs and structs you know the type at compile-time
anyway. So, all you need it one pointer per class to determine its type,
plus 50 or so bytes (depending on what the name string of type_info returns)
per class (not per object!). And of course, the compiler will only need to
generate this data if type information is required for a particular class.
Thorsten
____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde
Visit POV-Ray on the web: http://mac.povray.org
Post a reply to this message
|
|