After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 116183 - GOK does needless API calls when logging not enabled
GOK does needless API calls when logging not enabled
Status: RESOLVED WONTFIX
Product: gok
Classification: Deprecated
Component: performance
unspecified
Other Linux
: Normal normal
: ---
Assigned To: David Bolter
David Bolter
gnome[unmaintained]
Depends on:
Blocks: 109187
 
 
Reported: 2003-06-28 13:07 UTC by bill.haneman
Modified: 2011-10-14 11:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
simplifies gok spy ref calls when not logging (1.73 KB, patch)
2004-02-03 19:07 UTC, David Bolter
needs-work Details | Review
fixed patch (1.83 KB, text/plain)
2004-02-04 19:14 UTC, David Bolter
  Details

Description bill.haneman 2003-06-28 13:07:57 UTC
GOK does a lot of API calls (particularly to Accessible_getName)
for the purposes of providing log messages.  IN many cases (particularly in
gok_spy_accessible_implicit_ref()) these calls happen even if logging is
not enabled.

This is a performance hit we don't need to take.  I've patched the above
problem away in CVS, but I think we need to look at the issue of logging in
general and make sure that we're not calling API unnecessarily when GOK is
running in "normal" mode.

Also I think making logging a compile-time option is not as nice as making
it a runtime option, but that's a different bug :-)

Lastly, do we really need gok_spy_accessible_implicit_ref in the first place?
It seems like a diagnostic tool to me, perhaps it should be a runtime option.
Comment 1 David Bolter 2003-06-28 14:22:21 UTC
Good thinking and nice recent commits!  The diagnostic functions have
proven very useful in the past.  If we started #ifdef'ing I suggest we
do so in one place, and use MACRO expansion otherwise the code becomes
unecessarily complex.  Can we do this in ANSI C?
Comment 2 Calum Benson 2003-08-07 16:08:09 UTC
Apologies for spam... marking as GNOMEVER2.3 so it appears on the official GNOME
bug list :)
Comment 3 bill.haneman 2003-09-19 17:24:30 UTC
David:  I would go for a combination of

(1) converting debug mode from compile-time to runtime where feasible;
(2) moving redundant/reused code to functions that can be stubbed-out
    if debugging is not turned on
(3) creating some macros as you suggest.

Probably requires a nice thorough slog through the code, but probably
not more than a day's work.
Comment 4 David Bolter 2003-11-10 15:57:57 UTC
Bill, you mentioned you still wanted this bug - but that was a while
ago.  Is that still the case?  I think it makes sense for you to own
it since you have put thought into to the fix.
Comment 5 David Bolter 2004-02-03 19:04:42 UTC
I had a look at the code and noticed that as long as
HAVE_ISO_C99_VARIADIC or HAVE_GNU_VARIADIC is defined, gok won't make
the log calls if logging is not specified at build time.

The calls to gok_spy_accessible_ref and
gok_spy_accessible_implicit_ref aren't really a big deal.  I'll add a
patch to make them even less so.  I'm downgrading the priority on this
one.
Comment 6 David Bolter 2004-02-03 19:07:58 UTC
Created attachment 24034 [details] [review]
simplifies gok spy ref calls when not logging
Comment 7 bill.haneman 2004-02-04 14:24:46 UTC
putting priority back up.
David, I am seeing CORBA calls when logging is not enabled that ought
to be purely diagnostic.  I am not sure why the macro args are being
expanded, but they apparently are.
Comment 8 bill.haneman 2004-02-04 14:25:43 UTC
BTW gok-spy patch looks good, please commit.
Comment 9 David Bolter 2004-02-04 14:44:32 UTC
Its committed - thanks for the review.  I am intrigued about the corba
calls, are you convinced they come about from needless API calls?  Are
you certain that macro expansion is behind this?
Comment 10 David Bolter 2004-02-04 19:14:17 UTC
Bill rightly reverted this patch - a better one is coming.
Comment 11 David Bolter 2004-02-04 19:14:49 UTC
Created attachment 24067 [details]
fixed patch
Comment 12 bill.haneman 2004-02-04 19:20:54 UTC
I don't think this patch would have any performance impact to speak
of; just counter incrementing etc. is IMO not worth chasing.  We have
bigger fish to fry :)

I thought there were still some at-spi calls happenning when logging
is not enabled... 
Comment 13 David Bolter 2004-02-04 19:23:37 UTC
"We have bigger fish to fry :)" 
Agreed!  If I see any needless API calls I'll toss a patch here.

(That said, this patch should probably be applied since counters etc.
are only relevant if logging is enabled.)
Comment 14 David Bolter 2004-03-15 19:45:24 UTC
Bill are you still seeing those "CORBA calls" when logging is not enabled?
Comment 15 bill.haneman 2004-03-15 20:20:56 UTC
I believe so, but I'd need to investigate to give specifics.

One thing that we often do is call at-spi API and pass the params to
gok_log().  I think it might make sense to revise the gok-log API a
bit so that instead of just replicating fprintf, we passed enum values
into gok_log to correspond to the fprintf format string args.  For
instance we might pass gok_log a format string, a log level, an
accessible-object (or NULL), and an srgv array corresponding to the
format string.  Then:

gok_log (1, "object %s [%s]has %d children", object,
GOK_LOG_OBJECT_NAME, GOK_LOG_OBJECT_ROLE, GOK_LOG_OBJECT_CHILDCOUNT);

might mean log level 1, and GOK_LOG_OBJECT_NAME would mean "pass
Acceessible_getName (object) as param 1 of the format string", etc. etc.

This means of course that if gok_log evaluates to no-op, these atk
calls don't happen, but we don't have to use #ifdef build-time
brackets to prevent the calls.  This would also facilitate runtime
control of gok_log (including different log levels) which would be ab
improvement.

Lastly, instead of log levels we could use flags, thus

gok_log (GOK_LOG_UI_SEARCH | GOK_LOG_EVENTS, "....


Comment 16 bill.haneman 2004-03-25 12:52:05 UTC
removed patch keyword.

David, what do you think of my recent proposal above, which would deal with
macro expansion issues and argument expansion into gok_log calls?
Comment 17 David Bolter 2004-03-25 14:43:33 UTC
I think having log levels/flags/categories would be very useful.  I think maybe
your suggestions belong as a separate RFE though... ?
Comment 18 bill.haneman 2004-03-25 14:57:44 UTC
This is the best way I see for eliminating the 'needless API calls' since the
remaining costly calls are the ones which provide the gok_log macros their
parameters.  So I think this really is the same issue, this is my best shot at
solving it.
Comment 19 bill.haneman 2004-05-06 13:04:45 UTC
marking AP4, keeping normal priority; the need to fix this bug is mostly
internal to GOK.
Comment 20 Calum Benson 2004-10-21 16:52:05 UTC
Apologies for spam-- ensuring Sun a11y team are cc'ed on all current a11y bugs.
 Filter on "SUN A11Y SPAM" to ignore.
Comment 21 Akhil Laddha 2011-10-14 11:00:32 UTC
gok (GNOME on-screen keyboard) development has been stalled and it has been replaced by caribou [1]. Maintainers don't have future development plan so i am closing all the bugs as WONTFIX.

[1] https://mail.gnome.org/archives/gnome-bugsquad/2011-October/msg00001.html