Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #9833
| From | Lynn McGuire <lmc@winsim.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: does virtualizing all methods slow C++ down ? |
| Date | 2011-09-06 16:13 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <j462hr$1d9$1@dont-email.me> (permalink) |
| References | <j45hvi$6at$1@dont-email.me> <87ipp5zjb2.fsf@dpt-info.u-strasbg.fr> <j45rf0$d9e$1@dont-email.me> <j45tvf$f6c$1@speranza.aioe.org> <87ehztz9os.fsf@dpt-info.u-strasbg.fr> |
On 9/6/2011 3:40 PM, Alain Ketterlin wrote: > jacob navia<jacob@spamsink.net> writes: > >> Le 06/09/11 21:13, Lynn McGuire a écrit : >>> Thanks, I had not thought about the direct calls just >>> directly binding to the proper method. I'll bet that >>> there are few direct calls in our code though as we >>> have many children classes. >>> >>> ObjPtr -> DataGroup -> GenGroup >>> >>> ObjPtr -> DataGroup -> NodeGroup -> StreamGroup >>> >>> are a couple of example lineages. >>> >>> Lynn >> >> This is completely ridiculous. An indirect call vs a direct call >> will cost you some pipeline turbulence and the cache may be flushed, >> really not a big deal. > > Depends on the code. With lots of small methods (a la Java, with > getters/setters all over the place), it may be significant, mainly > because of the impossibility to inline. Take any program, compile it > with inlining disabled: the difference may be significant. > >> Have you MEASURED the slowdown? Is it significant in relationship >> to OTHER improvements in your code? > > Hard to measure. You need to change tens/hundreds of classes... > >> Have you profiled your code to KNOW where it is spending 90% of the >> time? > > In the case I mention above (many small functions), the overhead would > be spread over a large part of the code. Profiling becomes less useful. > >> Before you answer THOSE questions, worrying about direc/indirect >> calls is WASTED time and effort. > > I've just done this on a piece code that was evaluating an expression > tree on each vertex of a 4D grid, with an insane number of > floating-point ops. Incredible speedup (~120). Granted, the original was > over-engineered, and this may be a corner case. > > Regarding Lynn's case, I would say you're right: he may be better off > keeping his current design safe rather than trying to save a few cycles. > > -- Alain. You are more than correct, I was just wondering. In fact, we saved millions of cycles by porting our code from Smalltalk to C++. We had to do it anyway, our Smalltalk variant was Win16 (don't even go there !) without a Win32 port. I would not be surprised if we got a 100X speedup by converting to C++ and Win32. Our current design is solid and will not be changed - we have many other dragons to slay. Thanks, Lynn
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
does virtualizing all methods slow C++ down ? Lynn McGuire <lmc@winsim.com> - 2011-09-06 11:31 -0500
Re: does virtualizing all methods slow C++ down ? Christopher <cpisz@austin.rr.com> - 2011-09-06 10:00 -0700
Re: does virtualizing all methods slow C++ down ? Lynn McGuire <lmc@winsim.com> - 2011-09-06 14:09 -0500
Re: does virtualizing all methods slow C++ down ? Christopher <cpisz@austin.rr.com> - 2011-09-06 12:35 -0700
Re: does virtualizing all methods slow C++ down ? "Kevin P. Fleming" <news@kpfleming.us> - 2011-09-06 16:41 -0500
Re: does virtualizing all methods slow C++ down ? "Balog Pal" <pasa@lib.hu> - 2011-09-11 12:02 +0200
Re: does virtualizing all methods slow C++ down ? "Thomas J. Gritzan" <phygon_antispam@gmx.de> - 2011-09-07 02:42 +0200
Re: does virtualizing all methods slow C++ down ? Noah Roberts <roberts.noah@gmail.com> - 2011-09-07 07:39 -0700
Re: does virtualizing all methods slow C++ down ? Richard Damon <news.x.richarddamon@xoxy.net> - 2011-09-07 11:46 -0400
Re: does virtualizing all methods slow C++ down ? Nobody <nobody@nowhere.com> - 2011-09-07 01:45 +0100
Re: does virtualizing all methods slow C++ down ? Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2011-09-06 19:12 +0200
Re: does virtualizing all methods slow C++ down ? Lynn McGuire <lmc@winsim.com> - 2011-09-06 14:13 -0500
Re: does virtualizing all methods slow C++ down ? jacob navia <jacob@spamsink.net> - 2011-09-06 21:57 +0200
Re: does virtualizing all methods slow C++ down ? Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2011-09-06 22:40 +0200
Re: does virtualizing all methods slow C++ down ? Lynn McGuire <lmc@winsim.com> - 2011-09-06 16:13 -0500
Re: does virtualizing all methods slow C++ down ? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-09-07 08:01 +0000
Re: does virtualizing all methods slow C++ down ? Lynn McGuire <lmc@winsim.com> - 2011-09-14 12:08 -0500
Re: does virtualizing all methods slow C++ down ? Lynn McGuire <lmc@winsim.com> - 2011-09-14 14:04 -0500
Re: does virtualizing all methods slow C++ down ? Lynn McGuire <lmc@winsim.com> - 2011-09-06 16:11 -0500
Re: does virtualizing all methods slow C++ down ? Paavo Helde <myfirstname@osa.pri.ee> - 2011-09-07 11:44 -0500
Re: does virtualizing all methods slow C++ down ? Joshua Maurice <joshuamaurice@gmail.com> - 2011-09-07 14:11 -0700
Re: does virtualizing all methods slow C++ down ? Paavo Helde <myfirstname@osa.pri.ee> - 2011-09-08 01:26 -0500
Re: does virtualizing all methods slow C++ down ? Nobody <nobody@nowhere.com> - 2011-09-08 07:37 +0100
Re: does virtualizing all methods slow C++ down ? zindorsky <nephi.allred@gmail.com> - 2011-09-09 10:20 -0700
Re: does virtualizing all methods slow C++ down ? "Kevin P. Fleming" <news@kpfleming.us> - 2011-09-10 11:48 -0400
Re: does virtualizing all methods slow C++ down ? Nobody <nobody@nowhere.com> - 2011-09-10 17:58 +0100
Re: does virtualizing all methods slow C++ down ? Juha Nieminen <nospam@thanks.invalid> - 2011-09-07 06:19 +0000
Re: does virtualizing all methods slow C++ down ? Goran <goran.pusic@gmail.com> - 2011-09-06 23:52 -0700
Re: does virtualizing all methods slow C++ down ? Juha Nieminen <nospam@thanks.invalid> - 2011-09-07 07:57 +0000
Re: does virtualizing all methods slow C++ down ? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-09-07 10:39 +0000
Re: does virtualizing all methods slow C++ down ? Goran <goran.pusic@gmail.com> - 2011-09-07 04:30 -0700
Re: does virtualizing all methods slow C++ down ? Juha Nieminen <nospam@thanks.invalid> - 2011-09-07 13:04 +0000
Re: does virtualizing all methods slow C++ down ? Goran <goran.pusic@gmail.com> - 2011-09-07 06:18 -0700
Re: does virtualizing all methods slow C++ down ? ld <laurent.deniau@gmail.com> - 2011-09-08 05:34 -0700
csiph-web