aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2020-06-02 21:00:35 +0100
committerNick Alcock <nick.alcock@oracle.com>2020-07-22 17:57:34 +0100
commit5ec7465fec8bceb477732d6757112fe162116eb8 (patch)
tree53501c491c9e75c45e70d2e80c51f6ee1662b609
parent601e455b758b7075d3027c030b9bd60f7b7face5 (diff)
downloadfsf-binutils-gdb-5ec7465fec8bceb477732d6757112fe162116eb8.zip
fsf-binutils-gdb-5ec7465fec8bceb477732d6757112fe162116eb8.tar.gz
fsf-binutils-gdb-5ec7465fec8bceb477732d6757112fe162116eb8.tar.bz2
libctf: having debugging enabled is unlikely
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). libctf/ * ctf-subr.c (ctf_dprintf): _libctf_debug is unlikely to be set.
-rw-r--r--libctf/ChangeLog4
-rw-r--r--libctf/ctf-subr.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/libctf/ChangeLog b/libctf/ChangeLog
index da28502..4879804 100644
--- a/libctf/ChangeLog
+++ b/libctf/ChangeLog
@@ -1,5 +1,9 @@
2020-07-22 Nick Alcock <nick.alcock@oracle.com>
+ * ctf-subr.c (ctf_dprintf): _libctf_debug is unlikely to be set.
+
+2020-07-22 Nick Alcock <nick.alcock@oracle.com>
+
* ctf-impl.h (struct ctf_archive_internal)
<ctfi_unmap_on_close>: New.
(ctf_new_archive_internal): Adjust.
diff --git a/libctf/ctf-subr.c b/libctf/ctf-subr.c
index 114df84..a5cde9d 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;