public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org, Victor Leschuk <vleschuk@accesssoftek.com>
Subject: Re: [PATCH 3/8] Code cleanup: Split dwarf2_ranges_read to a callback
Date: Sun, 19 Feb 2017 21:26:00 -0000	[thread overview]
Message-ID: <20170219212609.GB1291@host1.jankratochvil.net> (raw)
In-Reply-To: <7ffd29af-218a-32e3-ac6a-207f0bc8a382@redhat.com>

On Fri, 17 Feb 2017 02:19:06 +0100, Pedro Alves wrote:
> std::function is a lot of unnecessary overhead here.  Unless you
> manage to trigger to small-function optimization (which you won't here,
> the callbacks are too big), this is forcing a heap allocation inside
> std::function for every call to dwarf2_ranges_process.

These microoptimizations lead to the still broken fundamental data types and
algorithms of GDB, having to wait for minutes to hours to print an expression
(although usually it is not printable anyway).

perf would show the problem if it is really significant.  It would be less
significant with tcmalloc which GNU libc systems still do not use by default.


> Let's only use std::function for it's intended use-case of when the
> design calls for taking, or more usually, storing, a callable whose
> type is not knowable at compile type.

You are defining a new C++ specification here?  I have checked the code as
I wrote it is a perfect use of std::function<> according to the ISO C++11
specification.

Thanks you have noticed current GCC has missed-optimization in this case and
that it can be workarounded by a template as you have suggested.  It leads to
worse compilation diagnostics and we can hope this hack can be removed in the
future.  Still I agree this workaround of GCC is worth the performance gain.


Jan

  reply	other threads:[~2017-02-19 21:26 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-12 20:23 [PATCH 1/8] Rename read_unsigned_leb128 to gdb_read_unsigned_leb128 Jan Kratochvil
2017-02-12 20:23 ` [PATCH 5/8] DWARF-5 basic functionality Jan Kratochvil
2017-02-17 11:41   ` Pedro Alves
2017-02-19 21:26     ` Jan Kratochvil
2017-02-20 11:41       ` Pedro Alves
2017-02-20 19:52         ` Jan Kratochvil
2017-02-20 20:07           ` [commit] " Jan Kratochvil
2017-02-12 20:23 ` [PATCH 2/8] Code cleanup: Split create_debug_types_hash_table Jan Kratochvil
2017-02-16 19:33   ` Pedro Alves
2017-02-12 20:23 ` [PATCH 3/8] Code cleanup: Split dwarf2_ranges_read to a callback Jan Kratochvil
2017-02-17  1:19   ` Pedro Alves
2017-02-19 21:26     ` Jan Kratochvil [this message]
2017-02-20 11:11       ` Pedro Alves
2017-02-12 20:23 ` [PATCH 8/8] DWARF-5: DW_FORM_data16 Jan Kratochvil
2017-02-17 12:09   ` Pedro Alves
2017-02-19 21:26     ` Jan Kratochvil
2017-02-20 11:44       ` Pedro Alves
2017-02-17 12:24   ` Pedro Alves
2017-02-12 20:23 ` [PATCH 6/8] DWARF-5: call sites Jan Kratochvil
2017-02-12 20:41   ` Eli Zaretskii
2017-02-17 11:57   ` Pedro Alves
2017-02-19 21:26     ` Jan Kratochvil
2017-02-12 20:23 ` [PATCH 7/8] DWARF-5: Macros Jan Kratochvil
2017-02-17 11:59   ` Pedro Alves
2017-02-12 20:23 ` [PATCH 4/8] Code cleanup: Refactor abbrev_table_read_table cycle Jan Kratochvil
2017-02-17  1:21   ` Pedro Alves
2017-02-16 15:23 ` [PATCH 1/8] Rename read_unsigned_leb128 to gdb_read_unsigned_leb128 Pedro Alves
2017-02-16 19:40   ` Jan Kratochvil
2017-02-16 20:01     ` Pedro Alves
2017-02-16 22:54       ` Pedro Alves
2017-02-17  1:28         ` Pedro Alves
2017-02-19 21:25         ` Jan Kratochvil

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=20170219212609.GB1291@host1.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=vleschuk@accesssoftek.com \
    /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).