From: Jonathan Wakely <jwakely@redhat.com>
To: "François Dumont" <frs.dumont@gmail.com>
Cc: "libstdc++@gcc.gnu.org" <libstdc++@gcc.gnu.org>,
gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] PR 83938 Reduce memory consumption in stable_sort/inplace_merge
Date: Wed, 24 Jun 2020 18:39:26 +0100 [thread overview]
Message-ID: <20200624173926.GG4137376@redhat.com> (raw)
In-Reply-To: <db2a8694-0d25-e9a6-bfd5-5a633e4ea119@gmail.com>
On 11/06/20 08:32 +0200, François Dumont via Libstdc++ wrote:
>As we are on patching algos we still have this old one.
>
>Â Â Â From the original patch I only kept the memory optimization part
>as the new performance test was not showing good result for the other
>part to change pivot value. I also kept the small change in
>get_temporary_buffer even if I don't have strong feeling about it, it
>just make sure that we'll try to allocate 1 element as a last chance
>allocation.
>
>Â Â Â Note that there is still place for an improvement. If we miss
>memory on the heap we then use a recursive implementation which then
>rely on stack memory. I would be surprise that a system which miss
>heap memory would have no problem to allocate about the same on the
>stack so we will surely end up in a stack overflow. I still have this
>on my todo even if I already made several tries with no satisfying
>result in terms of performance.
>
>Â Â Â Tested under Linux x86_64.
>
>Commit message:
>
>Â Â Â libstdc++: Limit memory allocation in stable_sort/inplace_merge
>(PR 83938)
>
>Â Â Â Reduce memory consumption in stable_sort/inplace_merge to what is used.
>
>   Co-authored-by: François Dumont <fdumont@gcc.gnu.org>
>
>Â Â Â libstdc++-v3/ChangeLog:
>
>   2020-06-11 John Chang <john.chang@samba.tv>
>               François Dumont <fdumont@gcc.gnu.org>
>
>Â Â Â Â Â Â Â Â Â Â Â PR libstdc++/83938
>Â Â Â Â Â Â Â Â Â Â Â * include/bits/stl_tempbuf.h (get_temporary_buffer):
>Change __len
>Â Â Â Â Â Â Â Â Â Â Â computation in the loop.
>Â Â Â Â Â Â Â Â Â Â Â * include/bits/stl_algo.h:
>Â Â Â Â Â Â Â Â Â Â Â (__inplace_merge): Take temporary buffer length from
>smallest range.
>Â Â Â Â Â Â Â Â Â Â Â (__stable_sort): Limit temporary buffer length.
>Â Â Â Â Â Â Â Â Â Â Â * testsuite/25_algorithms/inplace_merge/1.cc (test03):
>Test different
>Â Â Â Â Â Â Â Â Â Â Â pivot positions.
>Â Â Â Â Â Â Â Â Â Â Â * testsuite/performance/25_algorithms/stable_sort.cc: Test
>stable_sort
>Â Â Â Â Â Â Â Â Â Â Â under different heap memory conditions.
>Â Â Â Â Â Â Â Â Â Â Â * testsuite/performance/25_algorithms/inplace_merge.cc: New.
>
>Ok to commit ?
I'm very nervous about changes to sort algos that aren't absolutely
necessary for correctness. It needs careful review and lots of
testing. Please be patient.
next prev parent reply other threads:[~2020-06-24 17:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-11 6:32 François Dumont
2020-06-22 6:27 ` François Dumont
2020-06-24 17:39 ` Jonathan Wakely [this message]
2020-06-24 20:12 ` François Dumont
2020-11-18 20:43 ` François Dumont
2020-11-19 12:26 ` Jonathan Wakely
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=20200624173926.GG4137376@redhat.com \
--to=jwakely@redhat.com \
--cc=frs.dumont@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=libstdc++@gcc.gnu.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).