Giter Site home page Giter Site logo

Reduce compile times about spectre HOT 9 OPEN

nilsdeppe avatar nilsdeppe commented on September 6, 2024
Reduce compile times

from spectre.

Comments (9)

kidder avatar kidder commented on September 6, 2024

Partially addressed in #176

from spectre.

mar-celine avatar mar-celine commented on September 6, 2024

Addressed again in #441

from spectre.

nilsdeppe avatar nilsdeppe commented on September 6, 2024

Link time is addressed in #475

The major known outstanding problem is the libstdc++ implementation of std::tuple

from spectre.

nilsdeppe avatar nilsdeppe commented on September 6, 2024

We use IWYU now to help with this

from spectre.

nilsdeppe avatar nilsdeppe commented on September 6, 2024

Still need to:

  • optimize PCH
  • not use std::tuple
  • Split actions into tpp files that are compiled separately. For this we need to make sure we don't create db::DataBox because the construction of Deferred classes is (very surprisingly!) expensive.
  • Improve compilation time of Deferred and db::create. Most expensive part of db::create is by far the Deferred construction, second most is the splitting out of compute items and simple items from the list of all items. We should probably keep those separate and pass in two typelists as template parameters to db::DataBox

from spectre.

nilsdeppe avatar nilsdeppe commented on September 6, 2024

#4023

from spectre.

nilsdeppe avatar nilsdeppe commented on September 6, 2024

@macedo22 has done some profiling and it looks like option parsing is taking up a huge amount (50%) of compilation resources in executables

from spectre.

nilsdeppe avatar nilsdeppe commented on September 6, 2024

#5104

from spectre.

nilsdeppe avatar nilsdeppe commented on September 6, 2024

We recently found that src/NumericalAlgorithms/Spectral/Projection.cpp compiles quite slowly. This is most likely because of how we've implement StaticCache, which is recursive and does a lot of tensor products of different functions. We could:

  • Store a std::vector of function pointers and have a function that maps the arguments to operator() into the vector. Each of the functions whose pointers are in the std::vector must handle the static-ness to guarantee thread safety internally. The std::vector is created in the constructor of the StaticCache.
  • We might be able to move the template parameters from StaticCache onto the constructor in this case.
  • We could try use variadic auto to do this. The computer function is whose function pointers are stored in the std::vector. E.g.
template <auto... Args>
const T& computer() const {
  static T blah = generator_(Args...);
  return blah;
}
  • brigand likely has some facilities of doing tensor products of lists that we could hook into and is likely much faster than what we are doing now.

discussed with @wthrowe and @kidder

from spectre.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.