Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vcperf miss some templates #16

Open
qnope opened this issue Oct 18, 2020 · 2 comments
Open

vcperf miss some templates #16

qnope opened this issue Oct 18, 2020 · 2 comments

Comments

@qnope
Copy link

qnope commented Oct 18, 2020

Hello

I am trying to optimize the compile time of a home made library.
Until now, I was using clang -ftime-trace option that gives us a nice json to read, with the time of each template instantiation.

I saw that we can do the same with vcperf. However, when we compile simple code, vc perf does not output anything useful.... We get the time to parse includes, but nothing relevant about template instantiation.
However, on "heavy" templates, we do obtain information on the heavy one, and sometimes about the little also. (It is funny because vcperf does not catch them when there is only small ones)

Here a code sample :

template <int... is> struct seq {};

template <int Size, int... Is>
struct make_seqImpl : make_seqImpl<Size - 1, Size - 1, Is...> {};

template <int... Is> struct make_seqImpl<0, Is...> { using type = seq<Is...>; };

template <int generate> using make_seq = typename make_seqImpl<generate>::type;

int main() {
  constexpr auto seq = make_seq<5>{};
  return 0;
}

Here the command lines

vcperf.exe /start /level3 a
compilation from QtCreator or visual studio using MSVC
vcperf.exe /stop /templates a output.etl

What can I do?

Thanks :)

@kevcadieux
Copy link
Member

Hi qnope,

For scalability reasons, vcperf discards templates that don't have a significant impact on build time. If you still wish to see them, you can either:

  1. Modify vcperf to keep all instantiations (see ExpensiveTemplateInstantiationCache::DetermineTopPrimaryTemplates)
  2. Write your own analyzer using the C++ Build Insights SDK, where you'll have full control (example here).

Please be aware that option 1 will result in very large traces for long builds.

I hope this helps,

Kevin

@qnope
Copy link
Author

qnope commented Dec 6, 2020

Thanks for your answer :-)

Do you want me to do a Pull Request to add a "--full" option ?

Sorry for the late answer :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants