Techniques to reduce template compile time

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • PengYu.UT@gmail.com

    #1

    Techniques to reduce template compile time

    Hi,

    One problem to use templates extensively is that it tends to take a
    long time to compile. Other than changing to a different compiler, are
    there any techniques to reduce the compile time?

    Thanks,
    Peng

  • webinfinite@gmail.com

    #2
    Re: Techniques to reduce template compile time

    On Nov 3, 4:08 pm, "PengYu...@gmai l.com" <PengYu...@gmai l.comwrote:
    Hi,
    >
    One problem to use templates extensively is that it tends to take a
    long time to compile. Other than changing to a different compiler, are
    there any techniques to reduce the compile time?
    >
    Thanks,
    Peng
    I think you have to wait.

    Comment

    • Paavo Helde

      #3
      Re: Techniques to reduce template compile time

      "PengYu.UT@gmai l.com" <PengYu.UT@gmai l.comwrote in
      news:1194134930 .391257.191020@ 22g2000hsm.goog legroups.com:
      Hi,
      >
      One problem to use templates extensively is that it tends to take a
      long time to compile. Other than changing to a different compiler, are
      there any techniques to reduce the compile time?
      >
      1. Precompiled headers - if your compiler supports precompiled headers, put
      all template header includes into it and use it in all .cpp-s.

      2. If your templates work on a limited number of types, put the actual
      template definitions in .cpp files and add explicit template instantiations
      for all needed types there. Might not work over dll/so boundaries.

      3. Add more memory to your computer!
      Thanks,
      Peng
      >
      you are welcome!
      Paavo

      Comment

      Working...