From patchwork Sun Dec 2 20:27:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Bosscher X-Patchwork-Id: 203251 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id AD5B52C007E for ; Mon, 3 Dec 2012 07:28:34 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1355084916; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: MIME-Version:Received:From:Date:Message-ID:Subject:To: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=3Mwt2UH /Y/niHA3r9UAM8mECsew=; b=QctHTLWAnD/HWaA1+EYO6sozGUC2acHm2wWzvF/ idzV2A9bii2D1NlZtCIet6gIbVgkP/R0dk16ZsxtCtWvTJ6Go3Ysv8zEX1ATCg9k WuIlqBBvXL8YgyO7HicdwonN2K95wPq0mgIAFUkjUQ1gYB3CKb4tLLeiH6uNMGB9 IoMk= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:MIME-Version:Received:From:Date:Message-ID:Subject:To:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=bPlhwc5G0krompZ1uoFR3SfsYu8g9amymNVJiWWpd/KKebbqAD6sYtts9hUwVD 0NJDJRz31Lj35Kk8Ev6ohq+kIntLRERaP4GXy40KgXUJWvpF3IB005NNX+r0nCyO 1bupclv9tNfIsF/w9XpBp4hkKOpwaNCUB4yNOI3vF3GQQ=; Received: (qmail 29665 invoked by alias); 2 Dec 2012 20:28:32 -0000 Received: (qmail 29653 invoked by uid 22791); 2 Dec 2012 20:28:28 -0000 X-SWARE-Spam-Status: No, hits=-4.4 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-ia0-f175.google.com (HELO mail-ia0-f175.google.com) (209.85.210.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 02 Dec 2012 20:28:24 +0000 Received: by mail-ia0-f175.google.com with SMTP id z3so1698629iad.20 for ; Sun, 02 Dec 2012 12:28:24 -0800 (PST) Received: by 10.43.56.71 with SMTP id wb7mr6145476icb.20.1354480104126; Sun, 02 Dec 2012 12:28:24 -0800 (PST) MIME-Version: 1.0 Received: by 10.64.166.230 with HTTP; Sun, 2 Dec 2012 12:27:43 -0800 (PST) From: Steven Bosscher Date: Sun, 2 Dec 2012 21:27:43 +0100 Message-ID: Subject: [patch][c++] Stop in cp_write_global_declarations after writing a PCH To: GCC Patches X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hello, The C++ front end pushes everything through the compiler queue after writing a PCH. This is pointless: After the PCH is written nothing the compiler does has any effect on it anymore. This patch makes the C++ front end stop after writing the PCH, speeding up PCH creation The C front end has behaved this way since 2004 (http://gcc.gnu.org/ml/gcc-patches/2004-07/msg00738.html). Bootstrapped&tested on powerpc64-unknown-linux-gnu and x86_64-unknown-linux-gnu. OK for trunk? Ciao! Steven * decl2.c (cp_write_global_declarations): Return after writing a PCH. Compile time at -O2 (test = patched, orig = unpatched): $ for i in 1 2 3 ; do time ~/devel/build-test/gcc/xg++ -B../devel/build-test/gcc/ -w -O2 slow.h ; done ; ls -ltr real 0m8.577s user 0m8.037s sys 0m0.540s real 0m8.580s user 0m8.093s sys 0m0.484s real 0m8.595s user 0m8.093s sys 0m0.500s total 100440 -rw-r--r-- 1 stevenb stevenb 4017783 2012-12-02 21:16 slow.h -rw-r--r-- 1 stevenb stevenb 98722192 2012-12-02 21:20 slow.h.gch $ for i in 1 2 3 ; do time ~/devel/build-orig/gcc/xg++ -B../devel/build-orig/gcc/ -w -O2 slow.h ; done ; ls -ltr real 0m10.795s user 0m10.273s sys 0m0.520s real 0m10.876s user 0m10.365s sys 0m0.544s real 0m10.767s user 0m10.245s sys 0m0.520s total 100440 -rw-r--r-- 1 stevenb stevenb 4017783 2012-12-02 21:16 slow.h -rw-r--r-- 1 stevenb stevenb 98722192 2012-12-02 21:20 slow.h.gch Index: decl2.c =================================================================== --- decl2.c (revision 194052) +++ decl2.c (working copy) @@ -3944,8 +3944,13 @@ cp_write_global_declarations (void) || !vec_safe_is_empty (decl_namespace_list)) return; + /* This is the point to write out a PCH if we're doing that. + In that case we do not want to do anything else. */ if (pch_file) - c_common_write_pch (); + { + c_common_write_pch (); + return; + } cgraph_process_same_body_aliases ();