From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by sourceware.org (Postfix) with ESMTPS id 31F373858D33; Thu, 2 Mar 2023 05:39:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 31F373858D33 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-wr1-x432.google.com with SMTP id t15so15379893wrz.7; Wed, 01 Mar 2023 21:39:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=UGqfFcHGPlpfH/j96etoJAGLZVhtEi/Nx2mf0o+UkaU=; b=eEV7LddcH5xyFLgMJ3tE0dKLCIRrJcv4Fs67vtcflMmrRcg6n1eW9JGyMBUKREqugE TWTj34hqhjy8R2BElaTo9ZthX/RiXzqWg9J+TVSitJ9dtcFkKJfnZf+bPgcnCSToPOiN 0c3Jz/o1jVvRCo6ABoM/YttFyK7yIaU+wF8ucA7IscCODEyDleBxnfX578BGkzgW/PEt hUs+GP+SB5bgUg+S71rVvTw788wDD9KTMG8ZERBqmIV+zSvrWsSwfmHk7Tybk/r2vl4K gx5xsrGqtV+mUIo0zLVWnUVH2ODqEJ5KS3wjvi25tPav0gRQfX4V4WB00TU80/ELfxLi eXuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UGqfFcHGPlpfH/j96etoJAGLZVhtEi/Nx2mf0o+UkaU=; b=cY5244U8ASiH9PakgH6M3FVUyFV5DXBEIDJYggZ9LFJrKIlJTS7HJs4na2Q58LI6xO yq5FrvtOV5Cax0Jr9Ond6LjhifIsTywepFGJ450cUdSE050zHzsFe/pmF2vCfyLzQtQa Nsd48VovfUiTRn8Cjdz457EQuAsqHUjY5h2+qF/ehL61GKTwt730cQEoZl0o8JrOAz28 67JcFDIcPJV5xKjzNhYHS5Miuf4NQIbuSeG4VJLG22xmzjOTEPTqh+REBsxTv1LOMvpu pBC3jlF5ko3PhpRU68rQ3lATWME7dSQGQwRLjy2LAjT8OldWydqNcy2sQr2m2LzH61yq TJBg== X-Gm-Message-State: AO0yUKV2ATtoUQaxvS2BuM8XCp4v3J3Y96Je7bxMk2bqb/RHHxRJeDRR rJwOMRLl5hSinbEWdqtcmrr6Zb+76NA= X-Google-Smtp-Source: AK7set/MVfyl0ZykavQVaD6STllXlBjQt0c7W4+GiQsfjeNQRJ43Pi8eDs6gm6g14Y2Q8pzKwKDxKg== X-Received: by 2002:a5d:56c8:0:b0:2c7:156c:affd with SMTP id m8-20020a5d56c8000000b002c7156caffdmr6648221wrw.9.1677735574328; Wed, 01 Mar 2023 21:39:34 -0800 (PST) Received: from [10.13.0.64] ([109.190.253.11]) by smtp.googlemail.com with ESMTPSA id b10-20020adfee8a000000b002c54c8e70b1sm14960298wro.9.2023.03.01.21.39.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 01 Mar 2023 21:39:33 -0800 (PST) Message-ID: <195c8a11-acc7-1e78-091f-c7417d147e64@gmail.com> Date: Thu, 2 Mar 2023 06:39:30 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH] libstdc++: Limit allocations in _Rb_tree 2/2 From: =?UTF-8?Q?Fran=c3=a7ois_Dumont?= To: "libstdc++@gcc.gnu.org" Cc: gcc-patches References: <43172ea5-6729-02c5-d374-9537fff7eb4c@gmail.com> <7313d189-ae56-4582-6f23-9263dbf57dd3@gmail.com> <98823f83-ae62-f3e4-4091-01841b08fbb7@gmail.com> Content-Language: fr, en-US In-Reply-To: <98823f83-ae62-f3e4-4091-01841b08fbb7@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_NUMSUBJECT,NICE_REPLY_A,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Just forget about this patch, bad idea. The key_type might have additional data not used for the comparison. This data would not be preserved if we were inserting the already stored equivalent key instead of the user provided. On 22/02/23 07:08, François Dumont wrote: > This one is a refinement for multimap/multiset. > > It allows to have share the same key if managed with ref counting like > the cow string. > >     libstdc++: [_Rb_tree] Limit allocations on equal insertions [PR > 96088] > >     When inserting the same key several times prefer to insert the new > entry using the >     current stored key_type instance if this copy is noexcept. > Otherwise create a new >     key instance from input argument. > >     libstdc++-v3/ChangeLog: > >             PR libstdc++/96088 >             * include/bits/cow_string.h > (basic_string<>::basic_string(const basic_string&)): >             Add noexcept qualification when allocator is always equal. >             * include/bits/stl_tree.h > (_Rb_tree<>::_M_get_insert_equal_pos_tr): New. >             (_Rb_tree<>::_M_emplace_equal_tr): New, use latter. >             (_Rb_tree<>::_M_emplace_equal_aux): New, use latter. > (_Rb_tree<>::_M_emplace_equal<_Arg>(_Arg&&)): New, use latter. >             * testsuite/23_containers/multimap/96088.cc (test01): Add > check on redundant >             insertion. >             (test02): Likewise. >             * testsuite/23_containers/multiset/96088.cc (test01, > test02): Likewise. > > François