Zeoslib and size of binary. lazarus / 16-Databases ---------------------------------------------------------------------- chrnobel · 2008-11-27 13:06 Hi. I am making a "Hello World" console application (Linux), which has an binary size around 700K (400 after stripping). If I then in the same program just add Zcomponent to the uses clause, the size grows to more than 20M, which can be stripped to around 4M. This is still way to much, as the only thing I am interested in is a simple connection to MySQL, thus only using: ZConnection, ZDataset, and ZQuery. I have tried to uncomment support for all other databases than MySQL in Zeos.inc, but it makes little difference. Of course I could UPX the file, but that does not make the binary faster, rather the contrary. So does anyone have a good idea how to reduce the overhead of Zeoslib Chris ---------------------------------------------------------------------- DougNettleton · 2008-11-27 19:28 Hi Chris: Nobody here really seems interested in executable sizes.  If you consider the following: 1) Like you I have a still fairly trivial application, although not a console application. 2) It's using ZComponent & ZQuery's 3) It's 31.6 Million bytes 4) Launching the exe, the footprint is 3,288 K according to Task Manager 5) Connecting to the small Database - in my case Firebird, the footprint grows to 6,548K 6) Opening a Form with a Pagecontrol and several DBGrids, the footprint grows to 7,404K 7) It strips to 4.1 Million bytes using --strip-all so I guess my 10 meg of gui stuff strips to 100K Launching the "stripped" exe, the footprint is 3,424K according to Task Manager 9) Connecting to the Database, the footprint grows to 6,776K 10) Opening a Form with a Pagecontrol and several DBGrids, the footprint grows to 6,952K 11) It "packs" to 1.07 Million bytes using upx -9 12) Launching the "packed" exe, the footprint is 7,416K according to Task Manager 13) Connecting to the Database, the footprint grows to 10,684K 14) Opening a Form with a Pagecontrol and several DBGrids, the footprint grows to 11,000K So I compile / test / compile / test etc then strip the final exe which at least loads slightly faster. And never pack. To put all this in some sort of perspective, the "footprint" of FireFox I'm using to post this message - with 7 tabs open - is over 100Meg. Good Luck with your quest. Doug ---------------------------------------------------------------------- chrnobel · 2008-11-28 10:06 Hi Doug Let me explain some of the background. I have experienced the same as you, the only difference is that the platform used is Linux not Windows, but the figures for the footprint are, give and take, the same. So if I only were making a stand alone application I could not care a less, but the problem is that the program(actually many programs) is going to be used on a webserver, powered by PowTils. The problem is that although the program only runs for a split second and then releases memory again, there can be a risk of many (worst case hundreds) processes running at the same time. Therefore my interest in reducing the footprint. Chris ---------------------------------------------------------------------- Phil · 2008-11-28 15:51 Quote from: "chrnobel"Hi. I am making a "Hello World" console application (Linux), which has an binary size around 700K (400 after stripping). If I then in the same program just add Zcomponent to the uses clause, the size grows to more than 20M, which can be stripped to around 4M. Is Zcomponent an LCL component? If so, it probably pulls in a lot of LCL overhead. Look at its uses clause and see if any LCL units. Thanks. -Phil ---------------------------------------------------------------------- Phil · 2008-11-28 15:59 Quote from: "chrnobel"So if I only were making a stand alone application I could not care a less, but the problem is that the program(actually many programs) is going to be used on a webserver, powered by PowTils. The problem is that although the program only runs for a split second and then releases memory again, there can be a risk of many (worst case hundreds) processes running at the same time. You need to test your app on the Web server with PowTils to see exactly how much memory is used. In my preliminary tests of ExtPascal, I'm not seeing much of a memory increase with additional hits - probably due to its threaded design. http://code.google.com/p/extpascal/ Thanks. -Phil ---------------------------------------------------------------------- chrnobel · 2008-12-01 09:46 Quote from: "Phil" Is Zcomponent an LCL component? Nope. Quote from: "Phil"In my preliminary tests of ExtPascal, I'm not seeing much of a memory increase with additional hits - probably due to its threaded design. It is not directly comparable, as PowTils is not used threaded - the advantage is that memory is always released, and memory is only used the very short time the program runs. /Chris ---------------------------------------------------------------------- chrnobel · 2008-12-11 19:55 Strange?? Making a simple hello world program, adding Zcomponent to the uses clause, the binary has a size around 20M as mentioned. If I then make a unit with all the needed components, and then only adds this new unit to my program, the size of the binary is now only around 6M, but still I have all the functionality of ZComponent. Does anyone have any idea of this behavior? /Chris ---------------------------------------------------------------------- Phil · 2008-12-11 21:11 Quote from: "chrnobel"Strange?? Making a simple hello world program, adding Zcomponent to the uses clause, the binary has a size around 20M as mentioned. If I then make a unit with all the needed components, and then only adds this new unit to my program, the size of the binary is now only around 6M, but still I have all the functionality of ZComponent. Does anyone have any idea of this behavior? /Chris Create a new project, add a ZComponent to it, then use Project | View Source to see what's been added to your uses. With Lazarus packages, it pulls in more than it needs to. You can see this by adding an IPro component, then looking at the .lpr source - it's added TurboPowerIPro, which is not required for compiling and adds to the size of the .exe. Also, the Zeos .lpk's do appear to require LCL. Thanks. -Phil ---------------------------------------------------------------------- chrnobel · 2008-12-12 12:59 Quote from: "Phil" Create a new project, add a ZComponent to it, then use Project | View Source to see what's been added to your uses. It is a non graphical program, thus there is no source or rather the program is also the source Quote With Lazarus packages, it pulls in more than it needs to. I am aware of this, but still it does not explain why the file is smaller when ZComponent is called indirectly. Quote You can see this by adding an IPro component, then looking at the .lpr source Again, the program is non graphical. QuoteAlso, the Zeos .lpk's do appear to require LCL. It should be possible to use Zeoslib directly under FPC - how can this be done as LCL is not relevant in that scenario? /Chris ---------------------------------------------------------------------- Phil · 2008-12-12 14:33 Clearly I'm not understanding what you're doing. I would suggest that you work up one or more projects that demonstrate your concerns and upload them in a Mantis bug report. Thanks. -Phil ---------------------------------------------------------------------- chrnobel · 2008-12-13 23:45 Sorry I owe you an apology - I made a mistake. I have found out that I do only need ZConnection and ZDataset, which is what I have in second (helping) unit. The problem was, that when I was making the "stand-alone" program I was using ZComponent, which covers much more than just what I needed (and covered by ZConnection and ZDataset), probably including LCL parts, thus giving me the large binary. Have just made a new stand alone program, only using ZConnection and ZDataset, and now the binary is the expected size. My apologies. /Chris