[14/59] libctf: having debugging enabled is unlikely

Message ID 20200630233146.338613-15-nick.alcock@oracle.com
State New
Headers show
  • Deduplicating CTF linker
Related show

Commit Message

Alan Modra via Binutils June 30, 2020, 11:31 p.m.
The deduplicator can emit enormous amounts of debugging output,
so much so that a later commit will introduce a new configure flag
that configures most of it out (and configures it out by default).

It became clear that when this configure flag is on, but debugging is
not enabled via the LIBCTF_DEBUG environment variable, up to 10% of
runtime can be spent on branch mispredictions checking the _libctf_debug
variable.  Mark it unlikely to be set (when it is set, performance is
likely to be the least of your concerns).

	* ctf-subr.c (ctf_dprintf): _libctf_debug is unlikely to be set.
 libctf/ctf-subr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



diff --git a/libctf/ctf-subr.c b/libctf/ctf-subr.c
index 114df843212..a5cde9d6f20 100644
--- a/libctf/ctf-subr.c
+++ b/libctf/ctf-subr.c
@@ -183,7 +183,7 @@  int ctf_getdebug (void)
 _libctf_printflike_ (1, 2)
 void ctf_dprintf (const char *format, ...)
-  if (_libctf_debug)
+  if (_libctf_unlikely_ (_libctf_debug))
       va_list alist;