This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/33358] Slow calls through simple member function pointers
- From: "dleska at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Sep 2007 06:47:40 -0000
- Subject: [Bug c++/33358] Slow calls through simple member function pointers
- References: <bug-33358-15073@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from dleska at gmail dot com 2007-09-09 06:47 -------
(In reply to comment #1)
> VS seems to dispatch to some other function.
Yep - if the function is virtual, VS generates a stub that does the vtable
lookup. However for non virtual function the call is direct - which is much
faster than what gcc does.
Note that if I replace the first line of my example with 'class SomeClass;' -
gcc and VS generate comparable code. However when the class is defined at the
point of the call and does not use multiple/virtual inheritance, VS generates
significantly faster calls (at least for non-virtual functions).
Is this optimisation not possible in gcc?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33358