3 ms·
Now I'm wondering what is a good way to measure my project's top 100 redundantly instantiated templates.
by corysama 9y ago
Now I'm wondering what is a good way to measure my project's top 100 redundantly instantiated templates.
- colanderman 9y agofind build/ -name \*.o -exec nm -C \{} \; | egrep ' W .*<' | sort | uniq -c | sort -n is what I use. This lists all templated, implicitly instantiated, non-inlined symbols in increasing order of number of uses. Note that templates internal to libstdc++ will also show up and you may want to instantiate these too. Note that explicit instantiation won't decrease the size of your object files, only the compilation time. (By default, the linker throws away duplicate instantiations.)
- fnord123 9y agogcc has -ftime-report which is kinda opaque but still interesting.