code-size

Is there a method/function to get the code size of a C program compiled using GCC compiler? (may vary when some optimization technique is applied)

老子叫甜甜 提交于 2021-01-29 08:14:51
问题 Can I measure the code size with the help of an fseek() function and store it to a shell variable? Is it possible to extract the code size, compilation time and execution time using milepost gcc or a GNU Profiler tool ? If yes, how to store them into shell variables? Since my aim is to find the best set of optimization technique upon the basis of the compilation time, execution time and code size, I will be expecting some function that can return these parameters. MyPgm=/root/Project/Programs

Good practice class line count [closed]

こ雲淡風輕ζ 提交于 2020-01-10 08:50:30
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 4 years ago . I know that there is no right answer to this question, I'm just asking for your opinions. I know that creating HUGE class files with thousand lines of code is not a good practice since it's hard to maintain and also it usually means that you should probably review your

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

萝らか妹 提交于 2019-12-20 10:27:18
问题 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 the library with flags like -Os helps this somewhat, but not really very much. I have also

Instruction Lengths

五迷三道 提交于 2019-12-18 08:30:40
问题 I was looking at the different instructions in assembly and I am confused on how the lengths of different operands and opcodes are decided upon. Is it something you ought to know from experience, or is there a way to find out which operand/operator combination takes up how many bytes? For eg: push %ebp ; takes up one byte mov %esp, %ebp ; takes up two bytes So the question is: Upon seeing a given instruction, how can I deduce how many bytes its opcode will require? 回答1: There's no hard and

Is using an inline function as fast as directly writing the function body in the code?

谁说我不能喝 提交于 2019-12-10 11:38:31
问题 class MyClass { public: MyClass() { m_dbLoopStart = 0.0; m_dbLoopStop = 100.0; m_dbLoopStep = 0.001; } // Which of the following methods complete in a shorter time? void Foo1() const // This one? { for (double x=m_dbLoopStart; x<=m_dbLoopStop; x+=m_dbLoopStep) { f(x); } } void Foo2() const // Or, this one? { for (double x=m_dbLoopStart; x<=m_dbLoopStop; x+=m_dbLoopStep) { 2.0 * x + 1.0; } } private: double m_dbLoopStart, m_dbLoopStop, m_dbLoopStep; inline static double f(double x) { return 2

How to reduce code size of iPhone app?

大城市里の小女人 提交于 2019-12-03 12:23:38
问题 My iPhone app is getting ready to go to production and we like to cram in as much data as possible. When I poke around the generated .app file for my application I see a file named <executable name> which I assume is the compiled code. It is about 2.5 megs which seem large for what I am including in my app. What type of things should I check to make sure there aren't any unneeded items being included into my executable? 回答1: There are a number of things you could do -- 2.5 MB is a small app.

How to reduce code size of iPhone app?

心已入冬 提交于 2019-12-03 03:43:06
My iPhone app is getting ready to go to production and we like to cram in as much data as possible. When I poke around the generated .app file for my application I see a file named <executable name> which I assume is the compiled code. It is about 2.5 megs which seem large for what I am including in my app. What type of things should I check to make sure there aren't any unneeded items being included into my executable? There are a number of things you could do -- 2.5 MB is a small app. One obvious way is to verify that your binary is in fact stripped. This removes unused references (e.g.

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

点点圈 提交于 2019-12-02 21:22:27
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 the library with flags like -Os helps this somewhat, but not really very much. I have also experimented with GCC's -frepo command (even though all the documentation I've seen suggests that on Linux

MAP file analysis - where's my code size comes from?

安稳与你 提交于 2019-11-30 09:05:47
I am looking for a tool to simplify analysing a linker map file for a large C++ project (VC6). During maintenance, the binaries grow steadily and I want to figure out where it comes from. I suspect some overzealeous template expansion in a library shared between different DLL's, but jsut browsign the map file doesn't give good clues. Any suggestions? prashant This is a wonderful compiler generated map file analysis/explorer/viewer tool. Check if you can explore gcc generated map file. amap : A tool to analyze .MAP files produced by 32-bit Visual Studio compiler and report the amount of memory

Instruction Lengths

半世苍凉 提交于 2019-11-29 14:09:13
I was looking at the different instructions in assembly and I am confused on how the lengths of different operands and opcodes are decided upon. Is it something you ought to know from experience, or is there a way to find out which operand/operator combination takes up how many bytes? For eg: push %ebp ; takes up one byte mov %esp, %ebp ; takes up two bytes So the question is: Upon seeing a given instruction, how can I deduce how many bytes its opcode will require? Mehrdad Afshari There's no hard and fast rule for x86 without a database as the instruction encoding is pretty complex (and the