| Message ID | aljrFphQzm3wuq7k@arm.com |
|---|---|
| State | New |
| Headers |
Return-Path: <gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 82DC24BA23C3 for <patchwork@sourceware.org>; Thu, 16 Jul 2026 14:33:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 82DC24BA23C3 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=ICgvy1WM; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=ICgvy1WM X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11012054.outbound.protection.outlook.com [52.101.66.54]) by sourceware.org (Postfix) with ESMTPS id 7E8714BA23E0; Thu, 16 Jul 2026 14:31:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7E8714BA23E0 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7E8714BA23E0 Authentication-Results: sourceware.org; arc=pass smtp.remote-ip=52.101.66.54 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1784212315; cv=pass; b=Y0r2B6W4AAvM4agqtaMei2nROie1caeu7CLynpYeuBTZx8ExUsK0EOWxLxFJQsrRODeKmq3y3C7/UyBBQQOW6uhmPQ2C38YRx2WDQou9XCeIML6I2JCx/KT9weHmExCKW0Sq+LaRRDOXbEzirvkyqQkBRENwmgktJNmiOdKwzJU= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1784212315; c=relaxed/simple; bh=czzdx+vbSxjMRRqjSNhKJ5KJ0S7cZGGu5WtvdhC0s0Q=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:Message-ID: MIME-Version; b=rySH2+ZdVadvYRRj1+KP/t73iTRoMNU0bwdvN9YszJ7jQmPngkxgWozxdG9/MVkJHXYYHmX571SnV4W1zHe9y4/SDF64ZNz9cKRWqY/z8ED16miS08YcTNyV+RqibPGBOhRsVgLOpVXabbNqKXbc3mJIYjKLT8Ivy1EQy5O60G0= ARC-Authentication-Results: i=3; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=ICgvy1WM; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=ICgvy1WM DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7E8714BA23E0 ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=fH7k3vuUuzkdv78JsfuYfe0Vz/61z56XZLAAyOb1JP420/6n+4Q0htq3z1Q6/tIvRUlbP0iS9pJ0vb2fczHvzaj/Q/kXS/RhSqC4LWiH0hzGoSnWAJqo+K9Nnj5Hp+/fH8p9E7Ro/j84VOX4e/Hf5ChibLAV8yREOr+jm6GZxCkkJIyohllI6c7NpkfaXEMURc/1+RwIquHNKZ7aANjaeuvy36aAOMxGWjfwwXT75Ckc4l55qEuuTZwXXZZdVl4KefRHp72FbE59sc8zT7Yjh1JCBFBK9w4D9vbJT9MtiOPf9tQTYY2QuzpL+FWyuDDxhevAHl/YaCiJMX9v2i9iSA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=w5otgGg7eEJupq/E0Lf9uYR3uDTIYWOkfZGHwmRlD3Y=; b=sQ2ZEAj3B2Yn3Seygu23on0/beNYVHnTpBPrqUlCLwb9K2qOlsx3DxJnigJRZYq6fx51HMaGSrX2o17vhirAT1Q5UTubCbWRZi/uvu/sBuKhjXNSm7DkWivURcSyJLk58cKRlOQWHYRYXu4pbtP3jkx3YopvBxOnOSnaDzRn+q/ZARGBVz8xZnQxwoJkgfcWTFzY3nsLYxtBWSNMBxdnZphhwKT7RrVU0MhXquys6bHUwwR87EfRn9S/WAPuY1/PGJl9/9tTyKwE/k4kac4l3ZzuVUGDQOwd86uZsqjm4dc7QOThq3Fiz/HPklaQXqWO4lz+r5pTEMTv2jP+Dhvk4w== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 4.158.2.129) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=w5otgGg7eEJupq/E0Lf9uYR3uDTIYWOkfZGHwmRlD3Y=; b=ICgvy1WMsWnuLLs2+0oHqPua32TAwFm74cxXrvA5TKR5/JwHzbTQhO7CD+xKbseGbpqI+p7V2kToT1NN1TatLN6dNOjaIqF+/mS3Y3gTNec+HymikhVxXYiYivYu1ShHY/jtcFQ1c9n6/lJUaby2BELv2vAVEDEvAvd4mqMAebQ= Received: from DB8PR06CA0063.eurprd06.prod.outlook.com (2603:10a6:10:120::37) by DB9PR08MB6585.eurprd08.prod.outlook.com (2603:10a6:10:250::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.223.12; Thu, 16 Jul 2026 14:31:51 +0000 Received: from DU6PEPF0000B620.eurprd02.prod.outlook.com (2603:10a6:10:120:cafe::7f) by DB8PR06CA0063.outlook.office365.com (2603:10a6:10:120::37) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.223.12 via Frontend Transport; Thu, 16 Jul 2026 14:31:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 4.158.2.129) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=arm.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 4.158.2.129 as permitted sender) receiver=protection.outlook.com; client-ip=4.158.2.129; helo=outbound-uk1.az.dlp.m.darktrace.com; pr=C Received: from outbound-uk1.az.dlp.m.darktrace.com (4.158.2.129) by DU6PEPF0000B620.mail.protection.outlook.com (10.167.8.136) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.245.5 via Frontend Transport; Thu, 16 Jul 2026 14:31:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=n4O2Bn+YW2gjR6dJGTjB/+gLvfnQepCH4UbnaP2+A4Mdb1Z3Y6q5/26UojcV/dz9lBgPgfuvELvtrLp8y6b9CoSObAPMRYy+4sp/uAEO+VCXxKuplsRkWdJZexdMZXzAJ+uXOuhsppFdQPg0DCiyI/kkopG9TcHvoZAhMwOq0lvORAtqBZ/YF08Ul8+kNlxX4Zm8YSCce39U7Q0w0+BheKP8e22uXTPuEgXpmVKiRZWJqDB0ak7ILVzrjbkJyWlbcc5lMQmi1oYsMkv8N50Rwxy0qJC/VTJsF9slrD0NyhoVIAi9iCUhzV6NUqGOqstEfSi+1q4NmB1lRIUDDCS7CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=w5otgGg7eEJupq/E0Lf9uYR3uDTIYWOkfZGHwmRlD3Y=; b=kjK4/kGrnNRs83y3V33aPS/GEZsGIgr0ZbFOdnQ7guyolxa88BdDkUs0xpqhcfHf+dQzMcw3MSDGuLgmzulTFT6UrZcxwKRqVdR6/nWHCcuu4wCY3Gg/dgRKydqaBVpDn09fpTZznqipYjFWIZ5SERfQMI5LcrYZIHhL6IHpcnv0tUvp1ee87NfhR9nnRd5+YtdTplPEa7iNavwP4VFYce7m0AA0VUMJ+t2bgiS1u5wP2UOGWnvKCWSOOvAR9DahgDyVgacRc6TqyHkdjaTL048qBUfYxJfP6GG9IqMmGVuPnRA5GCvXBzsAypd3AD8SHjt7CAZlpadCyjzxAiVTRg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=w5otgGg7eEJupq/E0Lf9uYR3uDTIYWOkfZGHwmRlD3Y=; b=ICgvy1WMsWnuLLs2+0oHqPua32TAwFm74cxXrvA5TKR5/JwHzbTQhO7CD+xKbseGbpqI+p7V2kToT1NN1TatLN6dNOjaIqF+/mS3Y3gTNec+HymikhVxXYiYivYu1ShHY/jtcFQ1c9n6/lJUaby2BELv2vAVEDEvAvd4mqMAebQ= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from VI0PR08MB10392.eurprd08.prod.outlook.com (2603:10a6:800:210::10) by AM9PR08MB5921.eurprd08.prod.outlook.com (2603:10a6:20b:2d4::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.223.12; Thu, 16 Jul 2026 14:30:48 +0000 Received: from VI0PR08MB10392.eurprd08.prod.outlook.com ([fe80::cd7c:e19a:2072:75cc]) by VI0PR08MB10392.eurprd08.prod.outlook.com ([fe80::cd7c:e19a:2072:75cc%4]) with mapi id 15.21.0202.014; Thu, 16 Jul 2026 14:30:48 +0000 Date: Thu, 16 Jul 2026 15:30:46 +0100 From: Tamar Christina <tamar.christina@arm.com> To: gcc-patches@gcc.gnu.org Cc: nd@arm.com, libstdc++@gcc.gnu.org, jwakely@redhat.com, tkaminsk@redhat.com, ppalka@redhat.com Subject: [patch 4/4][libstdc++]: Inline simple regex repeating matches in DFS [PR126274] Message-ID: <aljrFphQzm3wuq7k@arm.com> Content-Type: multipart/mixed; boundary="G5ix4oNj7Rf6yFtU" Content-Disposition: inline In-Reply-To: <patch-20700-tamar@arm.com> X-ClientProxiedBy: LO6P265CA0014.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:339::12) To VI0PR08MB10392.eurprd08.prod.outlook.com (2603:10a6:800:210::10) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI0PR08MB10392:EE_|AM9PR08MB5921:EE_|DU6PEPF0000B620:EE_|DB9PR08MB6585:EE_ X-MS-Office365-Filtering-Correlation-Id: 6cdb3ee0-45b7-4b7c-4a80-08dee346f9bf x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; ARA:13230040|6049299003|1800799024|376014|366016|23010399003|56012099006|11063799006|10067099003|4053099003|18002099003|22082099003; X-Microsoft-Antispam-Message-Info-Original: 2LI4MQMN1t5y+1GAs2K2h5clo21R6ACmO4UgQ9pwR1fQxo3qBqJaNi6mFIFDxfeC7SDXyRaKXgZVmX2nlJFMVGA9dV8nYZsEWFNeuioqCWMLZxdJGsQduJfkqg4frsbHyj0dI6kz7ndaROMDzCJnrEd/YcH9KEUX4PbAvBJH9tfAileWGBX4RzeMi3pbkt0kPfUrXaFuI1vPUDgOWTlvVArfgOnZ3nVk08r7jHiN/POy4bc7MLtjumcuB4HpzzjrhS6DpaVU2JMCmpnz6JocOjloBIXZGk+Tr1LlNNcbOsaHJvHYbnvThWt5hJGAyWZQf06nghxwoZ7tROVRxxrxnkzfBPSb3Rad0rWdThZMw7erVdG9ivGFOssTf8iDc+0KgREusMn0LGroUKWk6+lAOLCmbAV2e2UrDRDngMczdnsjimMqQlU66sDOX84wQkm6h6PavasWHi0/ooZOXBwBysy90bGjsKxg+60iEWlcXdGnbp57WBp0K6ax+PpJOEm0G1DuiG65jFlU78rWCBYNlG055KA/e2gG+yU4FfBFreUb6PMYqTNVj6WqurmQX/9+pqgoSvXeve8BqzZJbhLo4hjGA2Yw/LBiD4m2D+WkSMxpaomya15MMgyl6c7iqNXpVuPZQ1w69IhKjPG9bcxlVhN1nCsjYDtZOE40RYmfP9M= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10392.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(6049299003)(1800799024)(376014)(366016)(23010399003)(56012099006)(11063799006)(10067099003)(4053099003)(18002099003)(22082099003); DIR:OUT; SFP:1101; X-Exchange-RoutingPolicyChecked: JUe8M9+xT66fwDlzET7F6P4i5yuyuBFf1s7V7B08AVA+/0AHERlFwZBXXP3FIQu63Fay8JteeF5q1JwC26lhbxUv70Ewem1H9m8WvPZR0QO/jaiSY8i/S6N4UpHD9RjRSrYNDKCO4ri+RIblkNHRJUzp4dhQUfmqlwIDr75Uaw5IgPMm24Z64KwB9AtieSgN8YgugwoWRox+r4FgR8rufziOjd/ImrZfDzCJM/b6OEYaI33abJ7coTw4NoQJS/87FYYgiL6yQD4lFvzEt5tlN4DG7H7y35SvCOZh5WkaGsfV+MdHMKCRZ/JigWmelgpugs5DWupqwYfLHSLMu55oXA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB5921 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DU6PEPF0000B620.eurprd02.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: baca4111-ce9d-47bb-784f-08dee346d483 X-Microsoft-Antispam: BCL:0; ARA:13230040|6049299003|36860700016|35042699022|23010399003|1800799024|376014|14060799003|82310400026|22082099003|18002099003|10067099003|56012099006|11063799006|4053099003; X-Microsoft-Antispam-Message-Info: xCwYQP9TLMgMXxJxuoOUFW9dVtb067a2RFXXHRYOjp1o4IJWOEfA+LLZXCtTlTcUOaCEvt9N2T7IaCRXSCeh4oqkhD6Q7HiS5o+N01wnaa6880HAzxeKVvpzEjfC7fh2ms6i3TH52w+mj5lqFDntD0/WOrYWjDF08Wbx/WB2dHYnEVnPCJHiUdzqmpV+ERWxLx1sVlUQlxda/ydi803BBOIDBqh2M3psLGlXqj+Rke9JjBIxNL1+n8pMq6ZDxuVJ8XCFgZbLs8fAkCi1eIaKhlWfl7YNabxqTExA8T5+MzJs9+MnGHTUTCpmZShD5lpTU72gs7xgNI1WlRRPBiWlKlXxZe6Sq19Zybk/6AFew9sc3hu0jyw6uWUSUCDdab3HWxm92bOJauk+T98kMnou5UlVQRaiXkDT5eXld6bcvyUNMe+cn2PqkkHKuPi+tBEbEWm9MNrZnnz8VrtDHn1aaYD559wRKvgWs3A+CkJ3ciYwJjtC/ZnfFDU1+gwbqZQrX7FXReZC2y7C/0xE+CEkzZxoS29YymWq3leTde1L8MY6hJkxdQXhoOna0EvsjIGusNUd6fYA0IhKoP1ni62lr+1fK8OGxG/90MiVDuc6WGgtb+BVarAMte4mb1a0o2m9raMaAMe+7V8WYLg2iZu3ZgXVjwpRlOiSS/MScPeyxrS1fZb/PohjYFm+4xXZRjhoEPJrpSLMgeZAlUZXEH6Vzg== X-Forefront-Antispam-Report: CIP:4.158.2.129; CTRY:GB; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:outbound-uk1.az.dlp.m.darktrace.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(6049299003)(36860700016)(35042699022)(23010399003)(1800799024)(376014)(14060799003)(82310400026)(22082099003)(18002099003)(10067099003)(56012099006)(11063799006)(4053099003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Q2n7ZszcskwsmteDezVwF5JIk4Bm/uZlYF4OCGkYufB7FfbbNGaAvVsMiNz9eywqxChqk5nxdK6dg+U6/pHvcf+A/JZRgEKclGO/l4KJkXY7+pex7ySg6OTTEFIwKYaD4Zzvhk05aD4k9mKSGiq+xpucLugYc1OsxHN+GdjIDWhq4QaSsKZ8P2wp5HHUSfaN3CCVIr7WScOCH2ojxY4Vp+XlgkrNvuNP2UbQCxhdlk0IIqktXLEihukrA+5HDgTSSc02GU30LMHF8lwmTdfPqO7ZDrncOF3YVE2Z8NPf9LM0ql2+mnPVec3qJFwRRr0rmzdb/+9rqr3BChWDkyUArYwiY9P7uLL+EiwXexCahbc8dYcbjvTIA+lNR5C7y6hFmKFLaiKyTC0Y+y/iC5PMAkehZZBkVKde+57Aawnt7IdtGIE05p8PkxeNN99LvV17 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jul 2026 14:31:50.9492 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6cdb3ee0-45b7-4b7c-4a80-08dee346f9bf X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[4.158.2.129]; Helo=[outbound-uk1.az.dlp.m.darktrace.com] X-MS-Exchange-CrossTenant-AuthSource: DU6PEPF0000B620.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6585 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org |
| Series |
[1/4,libstdc++] : Templatize regex executor traversal mode [PR126274]
|
|
Checks
| Context | Check | Description |
|---|---|---|
| linaro-tcwg-bot/tcwg_gcc_build--master-arm | success | Build passed |
| linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 | success | Build passed |
| linaro-tcwg-bot/tcwg_simplebootstrap_build--master-arm-bootstrap | success | Build passed |
Commit Message
Tamar Christina
July 16, 2026, 2:30 p.m. UTC
Optimize the common DFS NFA shape repeat -> match -> repeat, which is produced
by repeated character classes such as [\w]+, [^\s?#]+, and #+.
Since the second patch the DFS continuation already avoids pushing a separate
_S_fopcode_next frame for many states. This patch adds a small improvement
for greedy repeats.
After creating the same fallback and repeat bookkeeping frames as before, if
the repeated body is a single match state that returns to the repeat state,
consume that match state immediately and continue at the repeat.
Backtracking behavior is unchanged. _M_rep_once_more still creates the
restore/decrement frames, and the repeat exit fallback is still saved before
trying the body. If the body match fails, the helper returns
_S_invalid_state_id so the normal frame loop restores repeat state and tries
pending fallbacks.
Benchmark improvements compared to:
GCC 16:
email: 57.4%
URI: 57.2%
IPv4: 68.0%
GCC 15:
email: 6.7%
URI: 3.8%
IPv4: 23.2%
Bootstrapped Regtested on aarch64-none-linux-gnu,
arm-none-linux-gnueabihf, x86_64-pc-linux-gnu
-m32, -m64 and no issues.
Ok for master?
Thanks,
Tamar
libstdc++-v3/ChangeLog:
PR libstdc++/126274
* include/bits/regex_executor.tcc (_M_dfs_next): Inline consume matches
on _S_opcode_repeat.
---
--
Comments
On Thu, 16 Jul 2026, Tamar Christina wrote: > Optimize the common DFS NFA shape repeat -> match -> repeat, which is produced > by repeated character classes such as [\w]+, [^\s?#]+, and #+. > > Since the second patch the DFS continuation already avoids pushing a separate > _S_fopcode_next frame for many states. This patch adds a small improvement > for greedy repeats. > > After creating the same fallback and repeat bookkeeping frames as before, if > the repeated body is a single match state that returns to the repeat state, > consume that match state immediately and continue at the repeat. > > Backtracking behavior is unchanged. _M_rep_once_more still creates the > restore/decrement frames, and the repeat exit fallback is still saved before > trying the body. If the body match fails, the helper returns > _S_invalid_state_id so the normal frame loop restores repeat state and tries > pending fallbacks. > > Benchmark improvements compared to: > GCC 16: > email: 57.4% > URI: 57.2% > IPv4: 68.0% These are the cumulative improvements right? The previous patch had: email: 55.5% URI: 55.2% IPv4: 68.0% So the marginal improvement of this patch is around 2% for email / URI? Not sure the increased complexity and _M_handle_match logic duplication is worth it. > > GCC 15: > email: 6.7% > URI: 3.8% > IPv4: 23.2% > > Bootstrapped Regtested on aarch64-none-linux-gnu, > arm-none-linux-gnueabihf, x86_64-pc-linux-gnu > -m32, -m64 and no issues. > > Ok for master? > > Thanks, > Tamar > > libstdc++-v3/ChangeLog: > > PR libstdc++/126274 > * include/bits/regex_executor.tcc (_M_dfs_next): Inline consume matches > on _S_opcode_repeat. > > --- > diff --git a/libstdc++-v3/include/bits/regex_executor.tcc b/libstdc++-v3/include/bits/regex_executor.tcc > index 3a3bad8ecac485d452970c0aa26e6db34cabd1e5..558d29feaef1eecd9ec13ba395a53f3ede990178 100644 > --- a/libstdc++-v3/include/bits/regex_executor.tcc > +++ b/libstdc++-v3/include/bits/regex_executor.tcc > @@ -796,7 +796,28 @@ namespace __detail > { > _M_frames.emplace_back(_S_fopcode_fallback_next, > __state._M_next, _M_current); > - return _M_rep_once_more(__match_mode, __i); > + > + // Consume the match state here so the straight-line loop avoids > + // one extra _M_dfs_next dispatch per repeated character. The > + // repeat bookkeeping and fallback frames are still produced by > + // _M_rep_once_more, so backtracking order is unchanged. > + _StateIdT __next = _M_rep_once_more(__match_mode, __i); > + if (__next != _S_invalid_state_id) > + { > + const auto& __alt_state = _M_nfa[__next]; > + if (__alt_state._M_opcode() == _S_opcode_match > + && __alt_state._M_next == __i) > + { > + if (_M_current != _M_end > + && __alt_state._M_matches(*_M_current)) > + { > + ++_M_current; > + return __i; > + } > + return _S_invalid_state_id; > + } > + } > + return __next; > } > else > { > > > -- >
On Mon, 20 Jul 2026, Patrick Palka wrote: > On Thu, 16 Jul 2026, Tamar Christina wrote: > > > Optimize the common DFS NFA shape repeat -> match -> repeat, which is produced > > by repeated character classes such as [\w]+, [^\s?#]+, and #+. > > > > Since the second patch the DFS continuation already avoids pushing a separate > > _S_fopcode_next frame for many states. This patch adds a small improvement > > for greedy repeats. > > > > After creating the same fallback and repeat bookkeeping frames as before, if > > the repeated body is a single match state that returns to the repeat state, > > consume that match state immediately and continue at the repeat. > > > > Backtracking behavior is unchanged. _M_rep_once_more still creates the > > restore/decrement frames, and the repeat exit fallback is still saved before > > trying the body. If the body match fails, the helper returns > > _S_invalid_state_id so the normal frame loop restores repeat state and tries > > pending fallbacks. > > > > Benchmark improvements compared to: > > GCC 16: > > email: 57.4% > > URI: 57.2% > > IPv4: 68.0% > > These are the cumulative improvements right? The previous patch had: > > email: 55.5% > URI: 55.2% > IPv4: 68.0% > > So the marginal improvement of this patch is around 2% for email / URI? > Not sure the increased complexity and _M_handle_match logic duplication > is worth it. ... and hopefully we can get rid of _M_dfs_next as mentioned in the 2/4 patch thread. > > > > > GCC 15: > > email: 6.7% > > URI: 3.8% > > IPv4: 23.2% > > > > Bootstrapped Regtested on aarch64-none-linux-gnu, > > arm-none-linux-gnueabihf, x86_64-pc-linux-gnu > > -m32, -m64 and no issues. > > > > Ok for master? > > > > Thanks, > > Tamar > > > > libstdc++-v3/ChangeLog: > > > > PR libstdc++/126274 > > * include/bits/regex_executor.tcc (_M_dfs_next): Inline consume matches > > on _S_opcode_repeat. > > > > --- > > diff --git a/libstdc++-v3/include/bits/regex_executor.tcc b/libstdc++-v3/include/bits/regex_executor.tcc > > index 3a3bad8ecac485d452970c0aa26e6db34cabd1e5..558d29feaef1eecd9ec13ba395a53f3ede990178 100644 > > --- a/libstdc++-v3/include/bits/regex_executor.tcc > > +++ b/libstdc++-v3/include/bits/regex_executor.tcc > > @@ -796,7 +796,28 @@ namespace __detail > > { > > _M_frames.emplace_back(_S_fopcode_fallback_next, > > __state._M_next, _M_current); > > - return _M_rep_once_more(__match_mode, __i); > > + > > + // Consume the match state here so the straight-line loop avoids > > + // one extra _M_dfs_next dispatch per repeated character. The > > + // repeat bookkeeping and fallback frames are still produced by > > + // _M_rep_once_more, so backtracking order is unchanged. > > + _StateIdT __next = _M_rep_once_more(__match_mode, __i); > > + if (__next != _S_invalid_state_id) > > + { > > + const auto& __alt_state = _M_nfa[__next]; > > + if (__alt_state._M_opcode() == _S_opcode_match > > + && __alt_state._M_next == __i) > > + { > > + if (_M_current != _M_end > > + && __alt_state._M_matches(*_M_current)) > > + { > > + ++_M_current; > > + return __i; > > + } > > + return _S_invalid_state_id; > > + } > > + } > > + return __next; > > } > > else > > { > > > > > > -- > > >
diff --git a/libstdc++-v3/include/bits/regex_executor.tcc b/libstdc++-v3/include/bits/regex_executor.tcc index 3a3bad8ecac485d452970c0aa26e6db34cabd1e5..558d29feaef1eecd9ec13ba395a53f3ede990178 100644 --- a/libstdc++-v3/include/bits/regex_executor.tcc +++ b/libstdc++-v3/include/bits/regex_executor.tcc @@ -796,7 +796,28 @@ namespace __detail { _M_frames.emplace_back(_S_fopcode_fallback_next, __state._M_next, _M_current); - return _M_rep_once_more(__match_mode, __i); + + // Consume the match state here so the straight-line loop avoids + // one extra _M_dfs_next dispatch per repeated character. The + // repeat bookkeeping and fallback frames are still produced by + // _M_rep_once_more, so backtracking order is unchanged. + _StateIdT __next = _M_rep_once_more(__match_mode, __i); + if (__next != _S_invalid_state_id) + { + const auto& __alt_state = _M_nfa[__next]; + if (__alt_state._M_opcode() == _S_opcode_match + && __alt_state._M_next == __i) + { + if (_M_current != _M_end + && __alt_state._M_matches(*_M_current)) + { + ++_M_current; + return __i; + } + return _S_invalid_state_id; + } + } + return __next; } else {