From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B86003858404; Thu, 13 Oct 2022 17:12:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B86003858404 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665681134; bh=+WUFZZIh9yitj/04mRfp5ziBnNVA66mBQsfOT9SHXRA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=c4v7dhuzyQaUK1sAhQ0bVLv7qBLai1osA1XzMnA2vFSg0WdcLdH6RRh9KBfjGwArp TmyX/NhwfpBmZKm2RJZkMDFW7JzXkcKvH4L21s8DusZ4wkoAdqh9qZGsI5jbVpVqks IgEAjTF9kM1xvNJqTwiWabaWfyHkqfs7vl3pI5jg= From: "fdumont at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/103621] stable_sort could call std::__merge_sort_with_buffer directly in typical case Date: Thu, 13 Oct 2022 17:12:14 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: fdumont at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: target_milestone bug_status cc resolution Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103621 Fran=C3=A7ois Dumont changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |13.0 Status|UNCONFIRMED |RESOLVED CC| |fdumont at gcc dot gnu.org Resolution|--- |FIXED --- Comment #1 from Fran=C3=A7ois Dumont --- I think it has been fixed by: commit 63d182fb86e47323ac50d9368845d712e1f7da89 Author: Fran=C3=A7ois Dumont Date: Thu Jan 21 19:30:47 2021 +0100 libstdc++: Enhance branching in std::inplace_merge and std::stable_sort When we manage to allocate a buffer of the expected size we can simplify the code to perform the expected algorithm. libstdc++-v3/ChangeLog: * include/bits/stl_algo.h (__merge_adaptive): Adapt to merge only when buffer is large enough.. (__merge_adaptive_resize): New, adapt merge when buffer is too small. (__inplace_merge): Adapt, use latter. (__stable_sort_adaptive): Adapt to sort only when buffer is lar= ge enough. (__stable_sort_adaptive_resize): New, adapt sort when buffer is= too small. (__stable_sort): Adapt, use latter. Let us know otherwise.=