public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "simark at simark dot ca" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug symtab/27937] Performance regression of 8% due to assert in dwarf/read/attribute.h
Date: Tue, 01 Jun 2021 16:36:16 +0000	[thread overview]
Message-ID: <bug-27937-4717-iYS7X87shy@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-27937-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=27937

Simon Marchi <simark at simark dot ca> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simark at simark dot ca

--- Comment #1 from Simon Marchi <simark at simark dot ca> ---
I sometimes wonder if we should have a gdb_assert version that is only enabled
in development builds, that we could use in very hot paths like this one,
without affecting performance of production builds.  On one hand, it's not good
because problems could go unnoticed in production builds.  But if the
alternative is removing the assert because it is too costly, then having it
only in development builds is better than nothing.

Also, I was wondering if this would have any effect on your measurements:

diff --git a/gdbsupport/gdb_assert.h b/gdbsupport/gdb_assert.h
index 00553a786135..74dcd653cc4e 100644
--- a/gdbsupport/gdb_assert.h
+++ b/gdbsupport/gdb_assert.h
@@ -32,7 +32,7 @@
    replacing.  */

 #define gdb_assert(expr)                                                     
\
-  ((void) ((expr) ? 0 :                                                      
\
+  ((void) (__builtin_expect ((expr), 0) ? 0 :                                 
                     \
           (gdb_assert_fail (#expr, __FILE__, __LINE__, FUNCTION_NAME), 0)))

 /* This prints an "Assertion failed" message, asking the user if they

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2021-06-01 16:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-01  8:30 [Bug symtab/27937] New: " vries at gcc dot gnu.org
2021-06-01  8:30 ` [Bug symtab/27937] " vries at gcc dot gnu.org
2021-06-01 15:26 ` ssbssa at sourceware dot org
2021-06-01 16:36 ` simark at simark dot ca [this message]
2021-06-01 21:12 ` tromey at sourceware dot org
2021-06-04 15:28 ` tromey at sourceware dot org
2022-04-15 13:31 ` tromey at sourceware dot org
2022-04-15 13:58 ` tromey at sourceware dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-27937-4717-iYS7X87shy@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).