Raised This Month: $51 Target: $400
 12% 

Binary size comparison


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 06-23-2017 , 16:39   Binary size comparison
Reply With Quote #1

I've been using gcc to compile majority of my extensions for my variety of projects. Recently, some of the requests made me look into Windows binaries. I decided to give ambuild a shot to reduce the load of maintaining two compile procedures.

Projects work, but the python compiled projects (ambuild) have a larger size compared to gcc binaries. For referance, I compiled defib-fix extension for l4d2 on my Linux system and here are the sizes under both methods.
  • Python - 758 kb
  • gcc - 107 kb

My question would be that are there any drawbacks of using python compiler, as opposed to gcc?
__________________
Spirit_12 is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 06-23-2017 , 17:00   Re: Binary size comparison
Reply With Quote #2

Ambuild does an existing compiler, probably gcc (depending on how it's configured). The difference here depends on compiler options.

Last edited by klippy; 06-23-2017 at 17:01.
klippy is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 06-24-2017 , 15:56   Re: Binary size comparison
Reply With Quote #3

Did you configure with --enable-optimize? By default the binaries also include debug symbols, there is another configure flag to strip it out to a separate file.
__________________
asherkin is offline
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 06-24-2017 , 19:59   Re: Binary size comparison
Reply With Quote #4

Yes, I did configure it with --enable-optimize flag. I think my configure.py file has debug option, which was not enabled, but I'll give it a check.
__________________
Spirit_12 is offline
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 06-25-2017 , 02:55   Re: Binary size comparison
Reply With Quote #5

I have noticed the same thing with AMBuild and Clang 3.8. --enable-optimize adds the -O3 flag for GCC, but I believe Clang requires -g0. Also AMBuild always sets -g3 for Clang, which is not a valid option.

Edit: commenting out that line, rebuilding AMBuild and adding -g0 to my AMBuildScript indeed produces an extension without debugging symbols.
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.

Last edited by DJ Tsunami; 06-25-2017 at 03:08.
DJ Tsunami is offline
Fyren
FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren
Join Date: Feb 2106
Old 06-25-2017 , 04:14   Re: Binary size comparison
Reply With Quote #6

Testing locally, my clang 3.9 understands -g0 through -g3. Passing -g4 errors. A quick Google doesn't find any documentation about it, but the obvious guess is it's at least attempting to mimic gcc's parameters.
Fyren is offline
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 06-25-2017 , 04:32   Re: Binary size comparison
Reply With Quote #7

Interesting, indeed clang -O3 correctly strips debug symbols, but clang -O3 -g3 does not. In GCC -g can be used with -O, but apparently in Clang -g overrides -O?
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.

Last edited by DJ Tsunami; 06-25-2017 at 04:50.
DJ Tsunami is offline
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 06-25-2017 , 22:40   Re: Binary size comparison
Reply With Quote #8

I'm using gcc, and not clang.
__________________
Spirit_12 is offline
Fyren
FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren
Join Date: Feb 2106
Old 06-26-2017 , 01:01   Re: Binary size comparison
Reply With Quote #9

If you can provide your complete project on GitHub or an archive (the source and your build scripts), someone can try to take a look.
Fyren is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 06-26-2017 , 02:19   Re: Binary size comparison
Reply With Quote #10

Just to be clear, it is intentional that AMBuild-built binaries contain debug symbols – there is no bug or unexpected behaviour here.
__________________
asherkin is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:32.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode