From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: Victor Porton Newsgroups: comp.lang.ada Subject: Re: Tell whether a primitive subprogram was overridden Date: Tue, 19 Aug 2014 18:54:25 +0300 Organization: Aioe.org NNTP Server Message-ID: References: <1nlld44wut4kf.1l1mtjf7durro.dlg@40tude.net> <17wr6psgtju81$.vcio92x50jpn$.dlg@40tude.net> NNTP-Posting-Host: AnnUDmZwVERVUXyHDyOl5A.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Complaints-To: abuse@aioe.org User-Agent: KNode/4.13.3 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:21832 Date: 2014-08-19T18:54:25+03:00 List-Id: Dmitry A. Kazakov wrote: > On Tue, 19 Aug 2014 16:45:54 +0300, Victor Porton wrote: > >> Dmitry A. Kazakov wrote: > >>> You mean that a check would be more efficient than a dispatching call? I >>> don't think there would be much difference, except the case when the >>> subprogram has a long list of additional arguments or computed >>> arguments. That is usually the case when doing tracing stuff. In that >>> case you could think of some lazy parameter evaluation schema or upfront >>> checks as Adam suggested. >> >> No. I haven't described exactly what I do. >> >> I need to register (by calling a C function) a C wrapper around a method >> of my class as a callback subprogram. If my method is null, it is not >> necessary to register it and the C code would not call it. > > You certainly register it only once. Therefore it is indeed the overhead > of a single dispatching call = a couple of nanoseconds. If you are in this > area you should look at C code as well. It checks if something is > registered. The depending on the choice it does a jump or no jump. Jump is > also a nanosecond of so. No, I register it either once or zero times. If it is not registered, the program is a little faster. -- Victor Porton - http://portonvictor.org