Delphi: How to organize source code to increase compiler performance?

前端 未结 14 2127
一整个雨季
一整个雨季 2020-12-13 13:14

I\'m working on a large delphi 6 project with quite a lot of dependancies. It takes several minutes to compile the whole project. The recompilation after a few changes is so

相关标签:
14条回答
  • 2020-12-13 14:14
    • Do not compile on network drives. Seek time is dramatically worse.
    • Consider pointing your dcu ("unit output" directory to a ramdrive.
    • Limit the number of include/unit directories.
    • Try to avoid minor circular references that the compiler still accepts, specially for large units (e.g. generated ORM units for your OPF). It might cause large units to be compiled twice. (does Delphi allow minor mutual circulars, or is that a FPC only feature?)

    I never tried, but hardcoding all files with full/relative path in the central .dpr might also help (script to regenerate/update?). (you mention that above, but was it with path xx in '\path\yyy' notation?).

    Other long shots:

    • Use Kylix (file/dir I/O under Linux is dramatically better in my experience (though that is from FPC experience)). Maybe we need a reversed cross-kylix :-)
    • Use a separate (windows) build machine, and tweak NTFS over the registry to be less "safe". (which you don't care for, since everything is a revision system to begin with). Afaik these options can only be done global for all filesystems, hence the separate system. Throw in a raid array or Raptor too.
    • Forget solid state. Nice buzz atm, but the high write ratio will kill it eventually (both life and performance when it gets fuller and can't optimally allocate anymore), and you need the expensive intel ones to beat two $75 HD's in RAID.

    P.s. Sorry for the FPC references. I do both, and I sometimes don't know anymore what belongs to what.

    0 讨论(0)
  • 2020-12-13 14:15

    We had the same (or similar) problem. I of our package has compilation Time about 12 min. After changes, now we have moved to 32 sg.

    After many tests we found that the "problematic situation" was the following: In a single package:

    • The A unit uses a large number of units: U1, U2, U3, U4, ... U100 (Uses of Interface) in the same package. This is an important unit that centralizes all the initialization work.

    • All units of the package, U1, U2, U3, .., U100 uses unit A (use of implementation)

    This "circular reference" does not give compilation errors because the USES are different, but caused a large compile-time.

    SOLUTION: Eliminate the reference to each unit, U1, U2, U3 ,...., U100 in the A Unit.

    Now, A unit use a large number of units: U1, U2 ,...., U100, but the units U1, U2 ,..., U100, does not use the unit A.

    After this change the compile-time is down drastically.

    If you have a similar situation, you can try this.

    Excuse for my bad english.

    Greetings.


    Neftalí -Germán Estévez-

    0 讨论(0)
提交回复
热议问题