Re: Semantic difference of source files

Hans-Peter Diettrich <DrDiettrich1@aol.com>
Sat, 23 Aug 2008 23:49:27 +0200

          From comp.compilers

Related articles
[2 earlier articles]
Re: Semantic difference of source files barry.j.kelly@gmail.com (Barry Kelly) (2008-08-18)
Re: Semantic difference of source files DrDiettrich1@aol.com (Hans-Peter Diettrich) (2008-08-18)
Re: Semantic difference of source files gah@ugcs.caltech.edu (glen herrmannsfeldt) (2008-08-18)
Re: Semantic difference of source files gah@ugcs.caltech.edu (glen herrmannsfeldt) (2008-08-19)
Re: Semantic difference of source files marcov@stack.nl (Marco van de Voort) (2008-08-20)
Re: Semantic difference of source files gah@ugcs.caltech.edu (glen herrmannsfeldt) (2008-08-20)
Re: Semantic difference of source files DrDiettrich1@aol.com (Hans-Peter Diettrich) (2008-08-23)
Re: Semantic difference of source files marcov@stack.nl (Marco van de Voort) (2008-08-24)
Re: Semantic difference of source files Jatin_Bhateja@mentor.com (Jatin Bhateja) (2008-08-28)
Re: Semantic difference of source files m.helvensteijn@gmail.com (2008-08-28)
| List of all articles for this month |

From: Hans-Peter Diettrich <DrDiettrich1@aol.com>
Newsgroups: comp.compilers
Date: Sat, 23 Aug 2008 23:49:27 +0200
Organization: Compilers Central
References: 08-08-025 08-08-030 08-08-045
Keywords: performance, practice
Posted-Date: 24 Aug 2008 14:41:55 EDT

glen herrmannsfeldt schrieb:


>> Some languages IMO still compile very slowly. Where I can do a "make"
>> in Delphi, in order to only find the next error in my code, C++ coders
>> still complain about hours of compilation for huge projects.
>
> One complication with C and C++ is that some variables have file
> scope. Even if none do, the compiler has to be able to compile them,
> and so tends to keep data in memory (or backing store) through the
> whole file. Many functions in one file compile slower than they would
> as separate files.


But this is exactly what a Delphi IDE or FPC does. It keeps all public
information about every involved module in memory, so that the
compilation of a whole project can be done much faster than a separate
parse and compilation of every unit.


A project-wide compilation has another benefit, with regards to global
compiler or project settings. Once the public part of a module has
been parsed, with the current settings applied, it doesn't deserve
another parse throughout the remaining compilation. The weak
relationship between C header files and source modules, and IMO in
detail the introduction of namespaces in C++, prevents the
determination of common public information, that *should* be kept in
memory.


While namespaces can help to reduce the amount of required information
about "external" modules, during compilation, the specification only
added another dimension to the already existing unrelated hierarchies
of header files and source modules. The construction of the symbol
tables for the used namespaces requires parsing of *all* possible
sources (at least of all header files), and throwing away unused
information requires the same exhaustive parse for every single source
module. Please correct me if my analysis is wrong.


> Fortran compilers traditionally reinitialize just about everything on
> an END statement, before starting the next program unit.


Here the arbitrary layout of COMMON sections prevents the reuse of
information from a previous parse.


DoDi


Post a followup to this message

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