From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11989 invoked by alias); 17 Oct 2013 17:11:53 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 11385 invoked by uid 48); 17 Oct 2013 17:11:48 -0000 From: "yellow at rg3 dot name" To: gcc-bugs@gcc.gnu.org Subject: [Bug preprocessor/58770] New: GCC very slow compiling with #pragma once Date: Thu, 17 Oct 2013 17:11:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: preprocessor X-Bugzilla-Version: 4.8.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: yellow at rg3 dot name X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-10/txt/msg01205.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58770 Bug ID: 58770 Summary: GCC very slow compiling with #pragma once Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: preprocessor Assignee: unassigned at gcc dot gnu.org Reporter: yellow at rg3 dot name Created attachment 31026 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31026&action=edit Benchmark files Putting #pragma once in a header file, with or without additional classic include guards, makes GCC very slow. I've created a small benchmark that I'm attaching, with the following files: * common.h: a common file to be included 10,000 times, protected with guards or the pragma. In the tarball there are three versions to be tested. * header0000.h to header9999.h: header files that include common.h * all.h: header file that includes all header????.h files. * main.c: main program, includes common.h and all.h Building that program with gcc -o main main.c takes 1.5 seconds with #pragma once, while merely using include guards takes only 70 milliseconds.