From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) by sourceware.org (Postfix) with ESMTPS id 3C0403858D3C for ; Mon, 22 Aug 2022 18:15:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3C0403858D3C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=obs.cr Authentication-Results: sourceware.org; spf=none smtp.mailfrom=obs.cr Received: by mail-qt1-x830.google.com with SMTP id w28so8550563qtc.7 for ; Mon, 22 Aug 2022 11:15:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=obs-cr.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc; bh=5hugUnk1bRyll0xVNqovNs0QgAXvUuOB669AfvhpL7Y=; b=d0U2o2EK9tKWZkDccKcU2A83sqYdEtvmthCg+t1XDtCsTm87sTgfk1Bn9LeMFfKk14 g7Rer1KpYzDmOzsvTSR8oyql+SQ6wIGslzB43jTROBCFPugylr+gJ5f9C18I2OLSYcY5 52tDb5tpkkG33YRbICYHIQ9nOJ2me+XsFATtpzO+tAw2EzpjfJSx+fNfODbVPfgAfeH4 KgVz0wp1GtC3Te6e+sDQbrSETPkqn62dGeGnFnkKa4AXwtjgVZzjMuWlbO2HXB3qG/ZG UlYi8fwubhOowU3Ix8kvmWgFfoxzcaM62u46CHvrUHQ7z4CwkIYH9cDiL0CrCcOGgM06 qKrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc; bh=5hugUnk1bRyll0xVNqovNs0QgAXvUuOB669AfvhpL7Y=; b=7P0ypaCluQ9s6qSUVyuob8VoVmpzZZvyWpdZjZr4+pg16SSSNA1JhbGSsD8bKiCWNH wvFe4Ek20FF3KnfGChO0KiRATEnrSxcgLZfMZXCCU0Rh9l6j5eta/2LohXJqMF09exPZ TpuMCpdZsU8bPF+X8r7qT9XR3xjzQYWiUWf1tUBdRZRT3xIJpQe+HTDR5hrQcHLuI2Cm mDHSIlzYhFtWaBVRdDKavvjLuXQ/yKVrTws942aoUNB5ldkoPS+5K61yOvXkekDv3N4i Zw3b5Hz73i4xcGO6vanpW3svQNFsHqPtgt0yYBRMR7ylsoWwlVz/pLItYVjPcRGNWFfy wp0A== X-Gm-Message-State: ACgBeo0Bipvk7f93bVS+PUF7S2YOwn3yGW/yPb7ZeMayFMlLYDvCupLq FXE6IP6Na5UoVEbvoOmInPAJfc7J8PNwqbRd X-Google-Smtp-Source: AA6agR5Li5gsIAvRhir4pzBWJZ4SIaUbDtqudrLF87XDk+WJBMSx18M4kNbeixDHRmeArsHaWCVC0A== X-Received: by 2002:ac8:5c13:0:b0:343:6f19:2386 with SMTP id i19-20020ac85c13000000b003436f192386mr16499118qti.222.1661192119179; Mon, 22 Aug 2022 11:15:19 -0700 (PDT) Received: from localhost.localdomain (ip-192-24-137-251.dynamic.fuse.net. [192.24.137.251]) by smtp.gmail.com with ESMTPSA id do14-20020a05620a2b0e00b006bb0e5ca4bbsm9834049qkb.85.2022.08.22.11.15.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 11:15:18 -0700 (PDT) From: whh8b@obs.cr To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH] libstdc++: Optimize operator+(string/char*, string/char*) equally Date: Mon, 22 Aug 2022 14:15:08 -0400 Message-Id: <20220822181509.1032874-1-whh8b@obs.cr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Aug 2022 18:15:21 -0000 After consultation with Jonathan, we realized that there was a missed optimization opportunity in the implementation of the various forms of operator+ for string. operator+(char *, string) required a single allocation but operator+(string, char*) required two. This patch attempts to change that asymmetry. Again, I have been a longtime reader of the source code but this patch is one of my first attempts at contributing. I have attempted to follow all the rules but I am sure that I missed something. Please let me know if/how I can change the patch to make it acceptable. Thanks for all your hard work maintaing this vital piece of software! Will