gpt4 book ai didi

c++ - 分解 C++ 代码大小

转载 作者:可可西里 更新时间:2023-11-01 15:04:00 25 4
gpt4 key购买 nike

我正在为旧博文中的第一个问题寻找 Stack Overflow 风格的不错答案 C++ Code Size ,我将在下面重复:

I’d really like some tool (ideally, g++ based) that shows me what parts of compiled/linked code are generated from what parts of C++ source code. For instance, to see whether a particular template is being instantiated for hundreds of different types (fixable via a template specialization) or whether code is being inlined excessively, or whether particular functions are larger than expected.

最佳答案

如果您要查找 C++ 代码中膨胀的代码来源,我使用了“nm”。以下命令将列出您应用中的所有符号,其中最大的代码和数据 block 位于顶部:

nm --demangle --print-size --size-sort --reverse-sort <executable_or_lib_name> | less

关于c++ - 分解 C++ 代码大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2509734/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com