By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,260 Members | 1,279 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,260 IT Pros & Developers. It's quick & easy.

virtual table, type_info node, type_info function

P: n/a
I "think" I understand why a virtual table needs to be constructed
when polymorphic classes are being compiled.

Now, I also know what a type_info function and type_info node are
although I am not sure "when" they are constructed by the compiler?

Also, any books which talks about any of these 3 subjects in detail or
semi-detail would be nice.

Thanks.
Jul 19 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a

"skscpp" <sk*****@hotmail.com> wrote in message news:3a**************************@posting.google.c om...
I "think" I understand why a virtual table needs to be constructed
when polymorphic classes are being compiled.

Now, I also know what a type_info function and type_info node are
although I am not sure "when" they are constructed by the compiler?

Also, any books which talks about any of these 3 subjects in detail or
semi-detail would be nice.


There is a type_info class and a typeid function. How typeid and virtual
functions work is an implementation detail. How this works varies form
compiler to compiler. The important thing for you to know is that adding
polymorphism to the type adds a tiny space penalty and a virtual call is
slightly slower than a non-virtual one in most cases.
Jul 19 '05 #2

P: n/a

"Ron Natalie" <ro*@sensor.com> wrote in message news:3f***********************@news.newshosting.co m...
There is a type_info class and a typeid function.


Gak, before someone jumps on me, typeid is an operator NOT a functin.
Jul 19 '05 #3

P: n/a
i suppose it is a classical question...

Ron Natalie wrote:
There is a type_info class and a typeid function. How typeid and virtual
functions work is an implementation detail. How this works varies form
compiler to compiler. The important thing for you to know is that adding
polymorphism to the type adds a tiny space penalty and a virtual call is
slightly slower than a non-virtual one in most cases.


i need to perform image analysis and filter application many times per
second (max 25~30 fps) on images say 800x600x3byte.

we have three possibilities to operate on every byte:
1) directly (actual)
2) function call (intermediate)
3) virtual function call (nicest)

of course 1) should be the fastest and 3) the slowest, but would be the
difference of spent time so different? should i do some benchmarking on
my own?

thanks
domenico

-----[ Domenico Andreoli, aka cavok
--[ http://filibusta.crema.unimi.it/~cavok/gpgkey.asc
---[ 3A0F 2F80 F79C 678A 8936 4FEE 0677 9033 A20E BC50

Jul 19 '05 #4

P: n/a

Hi Domenico Andreoli,

"Domenico Andreoli" <ca***@freemail.it> schrieb im Newsbeitrag
news:vU*********************@twister2.libero.it...
i need to perform image analysis and filter application many times per
second (max 25~30 fps) on images say 800x600x3byte.


For this kind of application, I'd recommend using assembly language.
Processors like the Pentium 4 can perform multiple computations per
instruction and clock cycle (SSE2).
(refer to the processor documentation available from Intel, at
http://developer.intel.com/design/pentium4/manuals/, in that case)

This way, the function call overhead in C++ doesn't matter if you avoid
calling a method for every pixel by writing the actual analysis or filter
code in assembly language.

If that's not feasible for some reason, make sure your methods are terse,
inlined and avoid object construction in loops with hundreds of thousands of
iterations.

I hope that helps.

Regards,
Ekkehard Morgenstern.


Jul 19 '05 #5

P: n/a
These topics are covered in the following article:

http://www.eventhelix.com/RealtimeMa...erformance.htm

http://www.eventhelix.com/RealtimeMa...rformance2.htm

Sandeep
--
http://www.EventHelix.com/EventStudio
EventStudio 2.0 - Generate Sequence Diagrams and Use Case Diagrams in PDF
Jul 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.