comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Tell whether a primitive subprogram was overridden
Date: Tue, 19 Aug 2014 15:57:52 +0200
Date: 2014-08-19T15:57:52+02:00	[thread overview]
Message-ID: <17wr6psgtju81$.vcio92x50jpn$.dlg@40tude.net> (raw)
In-Reply-To: lsvkem$sh4$1@speranza.aioe.org

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.

Morale: premature optimization is the root of all evil.

[ And you never know if what you are doing would make the code faster,
until you measure it. ]

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  reply	other threads:[~2014-08-19 13:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-18 23:41 Tell whether a primitive subprogram was overridden Victor Porton
2014-08-18 23:52 ` Adam Beneschan
2014-08-18 23:57   ` Victor Porton
2014-08-19  9:50     ` Simon Wright
2014-08-19  1:29   ` Shark8
2014-08-19  7:31 ` Dmitry A. Kazakov
2014-08-19 13:45   ` Victor Porton
2014-08-19 13:57     ` Dmitry A. Kazakov [this message]
2014-08-19 15:54       ` Victor Porton
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox