I think that it should also be noted here that most other languages have
external libraries that house assorted pieces of their run times. A
minimal c++ application would include glibc (1.2MB) and stdc++ (~0.5MB).
These values depend on distribution but that is already 1.7MB. The
Lazarus application has very little external dependencies due to the
fact that the RTL contains all of the normal functions in it. In essence
you are ending up with an application which is mostly self contained.
The GUI libraries (GTK) are external but that is about it. This makes
for a very highly portable application with little concern for external
dependencies. I really appreciate this.
I once performed a static compile of a very simple C program so I could
use it in a foreign minimalist Linux install. The size astonished me. I
then compiled the "hello world" application (main() {puts("Hello
World!")}) and the statically linked version of this was over 300KB.
That is a one liner! The FreePascal equivalent is only 23KB.
Having been programming since the mid 70s and having written full blown
business applications that ran in 48KB I'm constantly amazed at how much
it takes to do so little. On the other hand FreePascal and Lazarus are
above average for code producing tools in this day and age. Even with
Delphi & Kylix a useful application tends to weigh in about 1.2-1.7MB in
size. But they still have a number of external dependencies. Just adding
GlibC to the Kylix app size puts it over Lazarus. You can also take a
look at the Visual Basic runtime library set. Its huge!
All in all Lazarus does an above average job. The best thing you can do
to reduce code size is to limit the number of components and units used.
Also if you add a components to an application and later remove them
make sure to remove the respective units from the uses clauses. Lazarus
is pretty good about pointing these out. Depending on the unit design
just adding a unit, even if unused, can add a significant amount of code.
I agree with the comments made in the previous post copied below. The
size of your application once the component set has been chosen will
grow very slowly. And once again I'd like to say that since smart
linking has been added the resultant size is above average and the load
times of the application are lightning quick when compared to others
that use more dynamic linking.
I think the code size will go down some more once the FreePascal guys
get their own linker going. The typical linker in Linux isn't real
effective at discarding unused code which also has shocked me. :-)
-Jon
Felipe Monteiro de Carvalho wrote:
On 10/15/06, Nataraj S Narayan <[EMAIL PROTECTED]> wrote:
I did as told. Now the size has come down from 14M to 2.7M. But still
isnt it on the higher side for a single form program, with 5 SQLQuery
components and about 50 lines of code?
This is a big FAQ, that I will answer here:
I created an image to illustrate this:
http://wiki.lazarus.freepascal.org/images/d/de/Lazarus_vs_cpp.png
What happens is that the hello world lazarus software already includes
a huge amount of features. It includes:
* XML handling library
* Image handling library for png, xpm, bmp and ico files
* Almost all widgets from the Lazarus Component Library
* All of the Free Pascal Runtime Library
So it's very big, but it already includes almost everything a
realworld non-trivial app will need.
The key thing is that because of the Free Pascal compiler and the way
lazarus forms operate, the software will increase in size very slowly
when you add extra forms, and add code to it.
So in fact, Lazarus produces horrible hello worlds, but in a real
world app it's size very quickly becomes much smaller then a
comparable project in c++ for example.
Lazarus executable size starts big, bug grows very slowly. My lazarus
ide executable has 8 MB, and it has millions of lines of code, and
hundreds of forms.
A c++ project (just an example, but applies to other languages / tools
too) starts very small on the hello world, but quickly grows
exponencially when you need features to write a non-trivial
application.
BTW, does the size affect the performance in anyway?
Unless you have so little memory that your program must stay on swap,
I don't think so.
--
Jon Foster
JF Possibilities, Inc.
[EMAIL PROTECTED]
541-410-2760
Making computers work for you!
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives