Profiling DLL/LIB Bloat

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. 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 pinpo

分析DLL / LIB膨胀

我在VS2005中继承了一个相当大的C ++项目,编译成一个大约5MB的DLL。 我希望减少库的大小,以便通过网络为从慢速网络共享中使用它的客户端加载速度更快。 我知道如何通过分析代码,包含和项目设置来做到这一点,但是我想知道是否有可用的工具可以更容易地确定哪些代码部分占用了大部分空间。 有什么办法可以生成DLL布局的“配置文件”? 什么是消费图书馆形象的空间和多少的报告? 当您构建DLL时,可以将/ MAP传递给链接器

What are some techniques or tools for profiling excessive code size in C/C++ applications?

I have a C++ library that generates much larger code that I would really expect for what it is doing. From less than 50K lines of source I get shared objects that are almost 4 MB and static archives pushing 9. This is problematic both because the library binaries are quite large, and, much worse, even simple applications linking against it typically gain 500 to 1000 KB in code size. Compiling t

在C / C ++应用程序中分析过多代码大小的一些技术或工具是什么?

我有一个C ++库,可以生成更大的代码,我真的希望它能做什么。 从少于50K行的源代码中,我得到几乎4MB的共享对象和9个静态存档。这是有问题的,因为库的二进制文件非常大,而且更糟糕的是,甚至连接它的简单应用程序通常也会增加500到1000 KB代码大小。 用像-Os这样的标志来编译这个库会有所帮助,但并不是非常有用。 我也尝试过使用GCC的-frepo命令(尽管我看过的所有文档都表明,在Linux上collect2会合并重复的模板),并

Premature optimization or am I crazy?

I recently saw a piece of code at comp.lang.c++ moderated returning a reference of a static integer from a function. The code was something like this int& f() { static int x; x++; return x; } int main() { f()+=1; //A f()=f()+1; //B std::cout<<f(); } When I debugged the application using my cool Visual Studio debugger I saw just one call to statement A and guess what

过早优化还是我疯了?

我最近在comp.lang.c ++中看到一段代码,它从函数返回一个静态整数的引用。 代码是这样的 int& f() { static int x; x++; return x; } int main() { f()+=1; //A f()=f()+1; //B std::cout<<f(); } 当我使用我的酷炫的Visual Studio调试器调试应用程序时,我看到只有一个调用语句A,并猜测我感到震惊。 我一直以为i+=1等于i=i+1所以f()+=1等于f()=f()+1 ,我会看到两个对f()调用,但我只看到一。

Would VS2008 c++ compiler optimize the following if statement?

if (false == x) { ...} as opposed to: if (!x) { ... } and if (false == f1()) { ...} as opposed to: if (!f1()) { ... } I think the if(false == ... version is more readable. Do you agree, or have another trick you can propose? Will it be just as fast? Thanks. This is why I do not like !x: if (25 == a->function1(12345, 6789) && 45 == b->function1(12345, 6789) &&

VS2008 c ++编译器会优化下面的if语句吗?

if (false == x) { ...} 而不是: if (!x) { ... } 和 if (false == f1()) { ...} 而不是: if (!f1()) { ... } 我认为if(false == ...)版本更具可读性,您是否同意或有另一个可以提出的技巧?它会一样快吗?谢谢。 这就是我不喜欢的原因!x: if (25 == a->function1(12345, 6789) && 45 == b->function1(12345, 6789) && !c->someOtherFunction(123)) { ... } 以下似乎更好: if

C++ STL container and in

Please consider the following: class CMyClass { public: CMyClass() { printf( "Constructorn" ); } CMyClass( const CMyClass& ) { printf( "Copy constructorn" ); } }; int main() { std::list<CMyClass> listMyClass; listMyClass.resize( 1 ); return 0; } It produces the following output: Constructor Copy constructor Now my question is: How do I avoid the copy

C ++ STL容器和中

请考虑以下几点: class CMyClass { public: CMyClass() { printf( "Constructorn" ); } CMyClass( const CMyClass& ) { printf( "Copy constructorn" ); } }; int main() { std::list<CMyClass> listMyClass; listMyClass.resize( 1 ); return 0; } 它产生以下输出: 构造函数 复制构造函数 现在我的问题是:我如何避免复制构造函数? 或者换句话说:如何在STL容器内创建对象

Bests practices for localized texts in C++ cross

In the current C++ standard (C++03), there are too few specifications about text localization and that makes the C++ developer's life harder than usual when working with localized texts (certainly the C++0x standard will help here later). Assuming the following scenario (which is from real PC-Mac game development cases): responsive (real time) application : the application has to minimize

以C ++为基础的本地化文本最佳实践

在当前的C ++标准(C ++ 03)中,关于文本本地化的规范太少,并且使得C ++开发人员在使用本地化文本(肯定C ++ 0x标准将在稍后提供帮助)时比平常更加困难。 假设以下场景(来自真正的PC-Mac游戏开发案例): 响应式(实时)应用程序 :应用程序必须将非响应时间最小化为“不明显”,因此执行速度非常重要。 本地化文本 :显示文本本地化为两种以上语言,可能更多 - 不期望固定数量的语言,应该易于扩展。 在运行时定义的

Rectangle detection / tracking using OpenCV

What I need I'm currently working on an augmented reality kinda game. The controller that the game uses (I'm talking about the physical input device here) is a mono colored, rectangluar pice of paper. I have to detect the position, rotation and size of that rectangle in the capture stream of the camera. The detection should be invariant on scale and invariant on rotation along the X

使用OpenCV进行矩形检测/跟踪

我需要的 我目前正在做一个增强现实游戏。 游戏使用的控制器(我在这里谈论物理输入设备)是一种单色,长方形纸张。 我必须在相机的捕捉流中检测矩形的位置,旋转和大小。 检测应该在规模上不变,并且沿X和Y轴旋转不变。 如果用户将纸张移开或朝向相机移动,则需要缩放比例不变。 我不需要知道矩形的距离,所以尺度不变性转化为尺寸不变性。 如果用户沿着其本地X轴和/或Y轴倾斜矩形,则需要旋转不变性。 这种旋转将纸

OpenCV Bounding Box

I am working on software using OpenCV in C++ environment. The objective is to detect a boxing glove and draw a bounding box around gloves contours . The problem I am running into is that the bounding box is drown more than once in fact multiple boxes are drawn. What I was trying to do over the past few days is to somehow eliminate the number of boxes drawn and have only one big bounding box d

OpenCV边界框

我正在C ++环境中使用OpenCV开发软件。 目标是检测拳击手套并围绕手套轮廓绘制边框 。 我遇到的问题是边界框不止一次被淹没,实际上多个框被绘制。 过去几天我试图做的是以某种方式消除绘制的盒子的数量,并且只画出一个大的边框。 我正在研究一些技术来填充整个对象,我相信这对于这种情况非常有帮助。 下面我发布了用于实现图像中显示结果的代码: vector<vector<Point> > contours; vector<Vec4i>

Detecting a cross in an image with OpenCV

I'm trying to detect a shape (a cross) in my input video stream with the help of OpenCV. Currently I'm thresholding to get a binary image of my cross which works pretty good. Unfortunately my algorithm to decide whether the extracted blob is a cross or not doesn't perform very good. As you can see in the image below, not all corners are detected under certain perspectives. I'

使用OpenCV检测图像中的交叉

我试图在OpenCV的帮助下检测输入视频流中的形状(十字形)。 目前我正在设定阈值以获得我的十字架的二元图像,效果很好。 不幸的是,我的算法来决定提取的blob是否是交叉的并不是很好。 正如您在下面的图片中看到的,并非在某些视角下检测到所有角落。 我使用findContours()和approxPolyDP()来近似我的轮廓。 如果我在这条近似曲线中检测到12个拐角/顶点,则认为该斑点是十字形。 有没有更好的方法来解决这个问题? 我

Detect object stored in Mat image opencv

I'm trying to detect an object using opencv and Visual Studio Ultimate using C++. I'm having problems concerning cv::Mat, I cannot find any example of object detection with that kind of variable but just with IplImage. I tried to use an IplImage code and convert it to Mat, but it didn't work. But i don not want to use IplImage, my first part of code is in Mat and I want to keep usi

检测存储在Mat image opencv中的对象

我试图使用C ++检测使用opencv和Visual Studio Ultimate的对象。 我遇到了有关cv :: Mat的问题,我找不到任何使用这种变量的对象检测示例,但仅使用IplImage。 我试图使用IplImage代码并将其转换为Mat,但它不起作用。 但我不想使用IplImage,我的第一部分代码是在Mat中,我想继续使用它。 我试图实际做的是在阈值之后检测从凸轮存储的图像中最大的矩形。 我已经完成了阈值部分,没关系,它可以工作,我可以将我的对象(