性能分析DLL / LIB Bloat [英] Profiling DLL/LIB Bloat

查看:110
本文介绍了性能分析DLL / LIB Bloat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在VS2005中继承了一个相当大的C ++项目,编译为大约5MB的DLL。我想减少图书馆的大小,以便通过网络加载更快的客户端从缓慢的网络共享使用它。

I've inherited a fairly large C++ project in VS2005 which compiles to a DLL of about 5MB. I'd like to cut down the size of the library so it loads faster over the network for clients who use it from a slow network share.

我知道如何做这通过分析代码,包括和项目设置,但我想知道是否有任何可用的工具,可以更容易找到代码的哪些部分消耗最多的空间。有没有办法生成DLL配置的配置文件?

I know how to do this by analyzing the code, includes, and project settings, but I'm wondering if there are any tools available which could make it easier to pinpoint what parts of the code are consuming the most space. Is there any way to generate a "profile" of the DLL layout? A report of what is consuming space in the library image and how much?

推荐答案

当您构建DLL时,可以传递< a href =http://msdn.microsoft.com/en-us/library/k7xkk3e2.aspx> / MAP 到链接器,以使其生成包含所有符号的地址的映射文件图片。您可能需要执行一些脚本来计算每个符号的大小。

When you build your DLL, you can pass /MAP to the linker to have it generate a map file containing the addresses of all symbols in the resulting image. You will probably have to do some scripting to calculate the size of each symbol.

使用strings实用程序扫描您的DLL可能会显示意外或未使用的可打印字符串(例如资源,RCS ID, __ FILE __ 宏,调试消息,断言等)。

Using a "strings" utility to scan your DLL might reveal unexpected or unused printable strings (e.g. resources, RCS IDs, __FILE__ macros, debugging messages, assertions, etc.).

此外,如果您尚未使用 / Os ,这是值得一试。

Also, if you're not already compiling with /Os enabled, it's worth a try.

这篇关于性能分析DLL / LIB Bloat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆