Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > virtual table, type_info node, type_info function

Reply
Thread Tools

virtual table, type_info node, type_info function

 
 
skscpp
Guest
Posts: n/a
 
      11-13-2003
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.
 
Reply With Quote
 
 
 
 
Ron Natalie
Guest
Posts: n/a
 
      11-13-2003

"skscpp" <(E-Mail Removed)> wrote in message news:(E-Mail Removed) 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.


 
Reply With Quote
 
 
 
 
Ron Natalie
Guest
Posts: n/a
 
      11-13-2003

"Ron Natalie" <(E-Mail Removed)> wrote in message news:3fb41115$0$25282$(E-Mail Removed) m...

> There is a type_info class and a typeid function.


Gak, before someone jumps on me, typeid is an operator NOT a functin.


 
Reply With Quote
 
Domenico Andreoli
Guest
Posts: n/a
 
      11-13-2003
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

 
Reply With Quote
 
Ekkehard Morgenstern
Guest
Posts: n/a
 
      11-14-2003

Hi Domenico Andreoli,

"Domenico Andreoli" <(E-Mail Removed)> schrieb im Newsbeitrag
news:vUUsb.116811$(E-Mail Removed)...
> 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.






 
Reply With Quote
 
EventHelix.com
Guest
Posts: n/a
 
      11-14-2003
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is type_info object? sumsin C++ 1 06-12-2008 08:54 AM
type_info Rahul C++ 9 12-09-2007 12:51 PM
Storing std::type_info =?ISO-8859-1?Q?Erik_Wikstr=F6m?= C++ 2 08-11-2007 02:02 PM
virtual ~type_info(); Bobo C++ 3 01-21-2004 06:41 AM
type_info, vtable sks_cpp C++ 54 08-27-2003 03:57 PM



Advertisments