473,396 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

GCC -- reducing compiled code size

We have a library that has 179385 lines of code.

With GCC, no debug information requested (no -g option) it creates a
31 meg long .a library file.

I think that it is excessive. Any idea what I can do to reduce the
size?

i
Jul 23 '07 #1
3 5720
Ignoramus3627 wrote:
We have a library that has 179385 lines of code.

With GCC, no debug information requested (no -g option) it creates a
31 meg long .a library file.

I think that it is excessive. Any idea what I can do to reduce the
size?
C++ _language_ imposes no requirements on the size of the produced
object code (or machine code). Please ask in the newsgroup dedicated
to your compiler (gnu.g++.help comes to mind).

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jul 23 '07 #2
On Mon, 23 Jul 2007 13:03:38 -0500, Ignoramus3627 wrote:
>I tried -DNDEBUG -Os -fvisibility-inlines-hidden, it reduced size by
only about 12%. Thanks, that was helpful, though I was hoping for more.
-s means "Strip all symbols". It's a linker option and should
considerably reduce your code size (-Os is a compiler option that
might also help but it's not the same as -s). Linker options are
displayed with ld --help.
--
Roland Pibinger
"The best software is simple, elegant, and full of drama" - Grady Booch
Jul 23 '07 #3
On Jul 23, 7:29 pm, "Victor Bazarov" <v.Abaza...@comAcast.netwrote:
Ignoramus3627 wrote:
We have a library that has 179385 lines of code.
With GCC, no debug information requested (no -g option) it creates a
31 meg long .a library file.
I think that it is excessive. Any idea what I can do to reduce the
size?
C++ _language_ imposes no requirements on the size of the produced
object code (or machine code). Please ask in the newsgroup dedicated
to your compiler (gnu.g++.help comes to mind).
Even then. The whole question is misformed: since when is there
any direct relationship between lines of code and size of a
library. With a little bit of clever use of templates, I can
get a library that big with only a thousand lines of code,
probably even less. On the other hand, it's pretty easy to
write code where the library size will be smaller than the
original C++ source code. Without seeing the exact code, it's
impossible to say whether the size is excessive or not. (Even
from a quality of implementation point of view.)

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Jul 24 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Peter Salzman | last post by:
Hi all, Newish PHP programmer here. I wrote a form select class to help reduce code clutter, but I don't think the effort was worth it. I was hoping to post my attempt and get some ideas from...
15
by: Ralf W. Grosse-Kunstleve | last post by:
****************************************************************************** This posting is also available in HTML format: http://cci.lbl.gov/~rwgk/python/adopt_init_args_2005_07_02.html...
5
by: Salvador I. Ducros | last post by:
Greetings all, I was hoping someone might be able to point me in the right direction. I'm currently using std::vector to maintain several lists whose objects are of unrelated types (classes)....
18
by: Ralf W. Grosse-Kunstleve | last post by:
My initial proposal (http://cci.lbl.gov/~rwgk/python/adopt_init_args_2005_07_02.html) didn't exactly get a warm welcome... And Now for Something Completely Different: class autoinit(object):...
12
by: Stuart MacMartin | last post by:
Looking for tricks for speeding up builds... We have an application with about 970 of our own classes of various sizes plus a fair number of routines. Over the past year the compile/link time...
0
by: Filipe Martins | last post by:
Hello to all. Ever had a problem when your print some reports in a printer other the one you use more frequently, in which the report width span more tban one page? I did, and didn't liked it. ...
8
by: Greg Merideth | last post by:
I've written a basic windows service to provide some helper xml functions for my web methods and even thou the service is only about 1k lines long with 1 timer, its mem usage is 10m and its vm mem...
4
by: Patrick | last post by:
I have a tablespace that contains the LOB data for 3 tables which exist in other tablespaces. Even after reorging the LOB tablespace with the LONG option, the high water mark is still too high. I...
8
by: Jeff | last post by:
I have a db that has a couple of times closed Access completely when Saving work. So I usually compact and decompile and this seems to fix the problem. But not his time. It has come back again....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.