Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Coffee corner » how to reduce binary size?
how to reduce binary size? [message #59486] Thu, 05 January 2023 02:53 Go to next message
Satervalley is currently offline  Satervalley
Messages: 18
Registered: December 2022
Promising Member
the binary size increased with version number.
my app is about thousands loc, under windows, release build, blitz disabled, CLang x64, compile option -Oz -flto, the binary size about 4m.
in the other hand, the SDL2 sample's binary size is 14KB(dynamic link to sdl dll).
about 2-3 years ago, version number 9xxx - 10xxx, the same app's binary size is about half or 1/3 of it under the newest U++.

[Updated on: Thu, 05 January 2023 02:55]

Report message to a moderator

Re: how to reduce binary size? [message #59503 is a reply to message #59486] Sun, 08 January 2023 16:13 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
TheIDE allows you to build "All static" or "Use shared libs" configs.
"All static" is a default configuration on Windows if I remember correctly. If you switch to "Use shared libs" binary size of your app will be smaller. A tradeoff is performance (dynamic name binding) and compatibility (this is usually a problem with Unix & libc).
If you build a Release conf of your app with map-file enabled you can check code size of every function linked into your app using this app.
It supports map-file formats of pretty much all compilers including old game consoles.


Regards,
Novo
Re: how to reduce binary size? [message #59505 is a reply to message #59486] Mon, 09 January 2023 23:55 Go to previous messageGo to next message
zsolt is currently offline  zsolt
Messages: 697
Registered: December 2005
Location: Budapest, Hungary
Contributor
For me, switching on BLITZ reduced binary size significantly. Why don't you enable it?

And these options also help: -ffunction-sections -fdata-sections
But I don't know why.
Re: how to reduce binary size? [message #59506 is a reply to message #59505] Tue, 10 January 2023 02:15 Go to previous messageGo to next message
Satervalley is currently offline  Satervalley
Messages: 18
Registered: December 2022
Promising Member
Because the U++ document says that Blitz can reduce compiling time but generate bigger binary(It seems it merges multi source files into a big one). and I've tested, disable Blitz reduce binary size slightly, a 3MB binary only 20KB smaller than it with Blitz enabled.
Re: how to reduce binary size? [message #59510 is a reply to message #59506] Tue, 10 January 2023 16:27 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
By merging multi source files into a big one BLITZ not only reduces compilation time but also improves compiler optimization because when compiler can see more source code in one pass it is able to perform better optimization. By doing this code size can increase (because of aggressive inlining) or decrease. It depends on code.

The easiest way to understand why your app is big is to generate a map file and analyze it with amap. Smile
If you post your map-file here I'll tell you what is wrong with your app.


Regards,
Novo
Re: how to reduce binary size? [message #59528 is a reply to message #59486] Tue, 17 January 2023 11:46 Go to previous message
jjacksonRIAB is currently offline  jjacksonRIAB
Messages: 220
Registered: June 2011
Experienced Member
You could go even further with an executable packer. I use upx to compress executables further.
Previous Topic: Free useful tools for the U++ Developer
Next Topic: 13600K vs 2400G
Goto Forum:
  


Current Time: Wed Apr 24 07:05:03 CEST 2024

Total time taken to generate the page: 0.02939 seconds