GNU bug report logs -
#12541
Prefer plain 'static' to 'static inline'.
Previous Next
Reported by: Paul Eggert <eggert <at> cs.ucla.edu>
Date: Sun, 30 Sep 2012 08:02:01 UTC
Severity: normal
Tags: patch
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
Full log
Message #29 received at 12541 <at> debbugs.gnu.org (full text, mbox):
> Date: Sun, 30 Sep 2012 11:48:15 -0700
> From: Paul Eggert <eggert <at> cs.ucla.edu>
> CC: 12541 <at> debbugs.gnu.org
>
> >> With the proposed change, the set of functions that are not always
> >> inlined expands to bidi_cache_iterator_state, bidi_char_at_pos, and
> >> bidi_fetch_char, and (if we also include functions that are partially
> >> inlined) bidi_cache_search and bidi_get_type.
> >
> > Were they also not inlined before the change?
>
> Most of these functions were inlined before the change. However, as
> described above, bidi_char_at_pos was only partially inlined before
> the change.
It surprises me that bidi_char_at_pos is only partially inlined, or
not at all, since its body is just this:
static inline int
bidi_char_at_pos (ptrdiff_t bytepos, const unsigned char *s, bool unibyte)
{
if (s)
{
s += bytepos;
if (unibyte)
return *s;
}
else
s = BYTE_POS_ADDR (bytepos);
return STRING_CHAR (s);
}
Perhaps that's because STRING_CHAR could call a function?
Likewise with bidi_get_type. This one was supposed to be as fast as
the C ctype macros, or close. Handa-san told me that the uniprop
tables he implemented for this should really be fast. Maybe again the
problem is that CHAR_TABLE_REF can call a function?
Anyway, it's disturbing that the functions you mention will no longer
be inlined, because they are at the lowest level of walking the buffer
and deciding what to do with the next character. In particular,
bidi_get_type and bidi_fetch_char are invoked for every character we
display, even if there's no R2L characters anywhere in sight. (By
contrast, bidi_cache_iterator_state and bidi_cache_search will only be
invoked if we bump into an R2L character.)
Nevertheless, I'm okay with removing the 'inline' qualifier from
bidi.c. If the performance hit is significant, I'm sure we will hear
from users shortly. Otherwise, I'll try to measure the performance
with and without 'inline' when I have time, and we can take it from
there.
This bug report was last modified 12 years and 287 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.