Re: Optimization techniques and runtime checks

Bart <bc@freeuk.com>
Thu, 9 May 2019 18:28:01 +0100

          From comp.compilers

Related articles
[4 earlier articles]
Re: Optimization techniques and runtime checks david.brown@hesbynett.no (David Brown) (2019-05-07)
Re: Optimization techniques and runtime checks DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2019-05-08)
Re: Optimization techniques and runtime checks david.brown@hesbynett.no (David Brown) (2019-05-08)
Re: Optimization techniques and runtime checks bc@freeuk.com (Bart) (2019-05-08)
Re: Optimization techniques and runtime checks DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2019-05-08)
Re: Optimization techniques and runtime checks david.brown@hesbynett.no (David Brown) (2019-05-08)
Re: Optimization techniques and runtime checks bc@freeuk.com (Bart) (2019-05-09)
Re: Optimization techniques and runtime checks david.brown@hesbynett.no (David Brown) (2019-05-09)
Re: Optimization techniques and runtime checks robin51@dodo.com.au (Robin Vowels) (2019-05-11)
Re: Optimization techniques and runtime checks genew@telus.net (Gene Wirchenko) (2019-05-11)
Re: Optimization techniques and runtime checks david.brown@hesbynett.no (David Brown) (2019-05-12)
| List of all articles for this month |
From: Bart <bc@freeuk.com>
Newsgroups: comp.compilers
Date: Thu, 9 May 2019 18:28:01 +0100
Organization: virginmedia.com
References: <72d208c9-169f-155c-5e73-9ca74f78e390@gkc.org.uk> 19-04-021 19-04-023 19-04-037 19-04-046 19-05-052 19-05-068 19-05-072
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
In-Reply-To: 19-05-072
Content-Language: en-GB

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]


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.