Path: csiph.com!3.us.feeder.erje.net!feeder.erje.net!news.linkpendium.com!news.linkpendium.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: Bart Newsgroups: comp.compilers Subject: Re: Optimization techniques and runtime checks Date: Thu, 9 May 2019 18:28:01 +0100 Organization: virginmedia.com Lines: 45 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <19-05-075@comp.compilers> References: <72d208c9-169f-155c-5e73-9ca74f78e390@gkc.org.uk> <19-04-021@comp.compilers> <19-04-023@comp.compilers> <19-04-037@comp.compilers> <19-04-046@comp.compilers> <19-05-052@comp.compilers> <19-05-068@comp.compilers> <19-05-072@comp.compilers> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="34008"; mail-complaints-to="abuse@iecc.com" Keywords: performance, comment Posted-Date: 09 May 2019 14:49:24 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com In-Reply-To: <19-05-072@comp.compilers> Content-Language: en-GB Xref: csiph.com comp.compilers:2310 On 08/05/2019 22:02, David Brown wrote: > On 08/05/2019 15:58, Bart wrote: >> My recent compilers (not for C; the language doesn't really allow it) >> have all been whole-program** compilers. > If your compiler can only be run as a whole-program compiler, then I > might not be so kind, and complain about the lack of scalability. Scalability is something I do keep in mind. At the moment a project totalling 100,000 lines of code might take half a second to build (to ..exe), using a particular version of my non-optimised, non-optimising compiler on my specific machine, which is not fast. Bigger programs can be organised into libraries, then each library is independently compiled, and the main application is kept small. I'm also developing a new embedded scripting language, which is only compiled on demand (like JIT although JIT now means something a little different), and which can also 'mop-up' a lot of code that would otherwise be in the main application. But my current project is about 30Kloc. It takes 0.2 seconds to build with a previous compiler, and 0.25 seconds with itself (it's a bit more elaborate, but it's its code generator that seriously needs a peep-hole optimiser). Neither have any conventional optimisation. (C is simpler to compile and with fewer passes is faster. Building SQLITE3 from two files (shell.c and the amalgamated sqlite3.c, totalling 250Kloc), takes 0.45 seconds (optimised compiler this time otherwise 0.6), on the same machine.) > (I have always been impressed that you have made a compiler at all - it > is not an easy job.  I have been critical that you have placed so much > emphasis on things that I see as barely relevant, such as the size and > speed of the compiler, rather than on correctly supporting the C > language and its features. The speed is what makes a whole-project compiler viable. [For embedded applications there are systems where the object code that the compiler generates is really the intermediate code from the first pass of the compiler, and the linker reads everything in including the libraries and does the optimization and code generation on the whole thing. Dunno how fast it is but it is my impression that all of the code in the chips in your car was built that way. -John]