Path: csiph.com!xmission!news.glorb.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!border1.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: BartC Newsgroups: comp.compilers Subject: Re: Alternative C compilers on x86_64 Linux? Date: Sat, 1 Oct 2016 22:17:10 +0100 Organization: A noiseless patient Spider Lines: 36 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <16-10-004@comp.compilers> References: <16-09-001@comp.compilers> <16-09-033@comp.compilers> <16-09-034@comp.compilers> <16-09-035@comp.compilers> <16-09-037@comp.compilers> <16-09-042@comp.compilers> <16-09-044@comp.compilers> <16-09-047@comp.compilers> <16-10-001@comp.compilers> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: miucha.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="5559"; mail-complaints-to="abuse@iecc.com" Keywords: C, performance Posted-Date: 05 Oct 2016 11:41:33 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com X-Received-Bytes: 2869 X-Received-Body-CRC: 4175469407 Xref: csiph.com comp.compilers:1791 On 30/09/2016 19:15, Hans-Peter Diettrich wrote: > BartC schrieb: >> I seem to remember some comment in this group that tokenising accounts >> for a big chunk of a compiler's runtime (50% or something). > > This seems to be a reasonable figure for C, including all those nasty > tasks which have to be done before a token can be passed on to the parser. > >> While it is true that doing a full compile will take longer than just >> raw tokenising, should that factor be of the order of 1000 times longer, >> or three magnitudes? > > Find out yourself. I already know the answer. It /doesn't/ take that much longer. Replace the grammar of your tokenizer by the C > grammar, and test again. I'd wonder if it would not reach the speed of > your tokenizer. Then add the preprocessor with file inclusion, macro > definition, recognition and expansion, conditional compilation, and test > again. Then add Ansi and Unicode string literals and symbol tables, and > test again. I don't need to do this work because it's already been done by Tiny C. Using a monolithic, working test program of 22K lines (25K lines including standard headers for tcc; 27K using gcc) Tiny C compiled it in no more than 0.07 seconds (at least 360K lps). gcc took from 2.2 seconds (unoptimised), to over 8 seconds (optimised). 3-12K lps. (Probably it strained the global optimiser having a large single module as usually the difference between -O0/-O3 is smaller .) Tiny C must be parsing the same C grammar and expanding the same macros as gcc. So whatever it takes to do that, can presumably be done at some speed faster than 350Klps.