From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by sourceware.org (Postfix) with ESMTPS id 844043858C52; Sat, 4 Feb 2023 13:31:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 844043858C52 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-x635.google.com with SMTP id ml19so22662142ejb.0; Sat, 04 Feb 2023 05:31:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=XWD/j3ih5mFgbguJJBvtT28YxasD5dKtGtO/URMC/LY=; b=RpFGZERr/yJNNQdAKQPm/TrkoFHaneow2YZ1ZXNzD8w8f1z+x97+qr8XAtTfGlaPMf ZNyfdjjyrDvAjIFc26gpehIa0eDKqzA9AXarEEll2IQY42vnv3M6TNfIygQkfKQisbob MQ98X478UUYzcNBKmv5p6FW2Hp7PspcVnITfhPojk+O62THcDImuo5aObwRuW7ii09nw o/qwPUoNNAa/kV5Sw0rYbzhE1ovuoVu1mUrARJRe8zrO3xxHfB8MSwab4iWYrZl3FeJc 0XZTeaMZfNYV9iOC5S0oZ6sJExRClHWdkQbeDPXWHmd7mdhLPdrLEaTMlEyvZtxPdrt5 IMgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=XWD/j3ih5mFgbguJJBvtT28YxasD5dKtGtO/URMC/LY=; b=P9cV++Wq1oYXGDHl6R94IEOcM2/Zon8L7Niij2yNWE8QkWoWC8xS3Od0gqZOMg65eX Axk2D01m6kL5xD4kJq0wXscc0kRlmU3YP6BWgXbi18j3NDN+JrvmOYhi/uESbmCmNhhv 2/btMSiGcGrojrHjNgIXovfefujOuhDj/f7dEWI/KBoVVBlD/bW/CVl1GHpotD2QKjrp rBpUAbtasTc2zVj49yRrpRqykanDC069jbhU12iXru1cLTEy+kranBrIGy50bKfogrlr PXmMQtN/uC08ZEMzAZLhZaHDzbSVbv5qATzx9AwbvDK9LSx22Gx6ZDT43z0xxC8Zd9FN B/lQ== X-Gm-Message-State: AO0yUKVhDx1mUlZ0R97KDaRV3wAMwF9LIscfODhNUWNnqAZUTuQREJ5j q1vYGMNnV0QvzHTwPBIuzrfqfD5/wvYScMpCSO4= X-Google-Smtp-Source: AK7set8nDU7z+ziyo2l94atYtTT6Ksha4L/mpcm2eorD2vpvUTD/PETK8mxE4ggJiyDdnOJbI2vzJZGrfE8Qe35l9tY= X-Received: by 2002:a17:906:9586:b0:88f:9c9a:828 with SMTP id r6-20020a170906958600b0088f9c9a0828mr1266734ejx.190.1675517470287; Sat, 04 Feb 2023 05:31:10 -0800 (PST) MIME-Version: 1.0 References: <52e5d904-da8a-14f1-6704-53f89dbd2d69@gmail.com> <9f3648a8-0cbd-4fe8-1a9d-1902d9ab415c@gmail.com> In-Reply-To: <9f3648a8-0cbd-4fe8-1a9d-1902d9ab415c@gmail.com> From: Jonathan Wakely Date: Sat, 4 Feb 2023 13:30:58 +0000 Message-ID: Subject: Re: [PATCH] minor optimization bug in basic_string move assignment To: =?UTF-8?Q?Fran=C3=A7ois_Dumont?= Cc: Jonathan Wakely , "libstdc++" , waffl3x , gcc-patches Content-Type: multipart/alternative; boundary="000000000000a1aa4905f3dfcf20" X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --000000000000a1aa4905f3dfcf20 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, 4 Feb 2023, 13:12 Fran=C3=A7ois Dumont via Libstdc++, < libstdc++@gcc.gnu.org> wrote: > On 03/02/23 15:50, Jonathan Wakely wrote: > > On Wed, 25 Jan 2023 at 18:38, Fran=C3=A7ois Dumont > wrote: > >> Let's submit a proper patch proposal then. > >> > >> The occasion for me to ask if there is any reason for cow string not > >> being C++11 allocator compliant ? Just lack of interest ? > > Mostly lack of interest, but also I don't really want to "encourage" > > the use of the old string by investing lots of maintenance effort into > > it. If you want new features like C++11 Allocators and > > resize_and_overwrite etc then you should use the new type. > > > > I don't remember if there were any actual blockers that made it > > difficult to support stateful allocators in the COW string. I might > > have written something about it in mails to the list when I was adding > > the SSO string, but I don't remember now. > > Ok, thanks for feedback. I won't bother then. > > > > > Anyway, for this patch ... > > > >> I wanted to consider it to get rid of the __gnu_debug::_Safe_container > >> _IsCxx11AllocatorAware template parameter. > >> > >> libstdc++: Optimize basic_string move assignment > >> > >> Since resolution of Issue 2593 [1] we can consider that equal > >> allocators > >> before the propagate-on-move-assignment operations will still be > equal > >> afterward. > >> > >> So we can extend the optimization of transfering the storage of > the > >> move-to > >> instance to the move-from one that is currently limited to always > equal > >> allocators. > >> > >> [1] https://cplusplus.github.io/LWG/issue2593 > >> > >> libstdc++-v3/ChangeLog: > >> > >> * include/bits/basic_string.h (operator=3D(basic_string&= &)): > >> Transfer move-to > >> storage to the move-from instance when allocators are > equal. > >> * > >> testsuite/21_strings/basic_string/allocator/char/move_assign.cc > (test04): > >> New test case. > >> > >> Tested under linux x86_64, ok to commit ? > > OK for trunk, thanks! > > > > +Reviewed-by: Jonathan Wakely > > Should I have added this to the commit ? > > If so sorry, I haven't. > No problem! I think it would be a good habit for us to all start doing that (copying the glibc project), to thank people who take the time to do a review. I don't really mind if my name gets recorded as reviewer, but I'm going to try to remember to add Reviewed-by: when I review something. And that might encourage others to do the same, and to do more reviewing :-) > --000000000000a1aa4905f3dfcf20--