Re: Reducing the size of executables produced by GNAT



First of all, many thanks for you anwers to all of you :)

On 13 fév, 15:38, Martin Krischik <krisc...@xxxxxxxxxxxxxxxxxxxxx>
wrote:

Seehttp://en.wikibooks.org/wiki/Ada_Programming/Basic#FAQ:_Why_is_.22Hel....
I saw this one, but when I try to compile the exemple with "gnatmake -
Phello_world", I just get compilation errors. I've removed the options
which turned into error, but then finally the size is the same.

Note: I'm using gcc-ada which comes with MinGW (for Windows XP), and
the last version of gcc-ada from Debian (for an old Linux machine).

Well, the record is 8kb for Linux-i686-Release.
I would like to get the same :(

No nessesarily, static linked files are large but might load faster. All
depends of course. If startup is important then guesswork won't help -
you have to time it.
Oops, I've sid something wrong : when I was talking about a statically
linked application, I was talking about a staticaly linked GNAT
runtime. Apart of that, there are still dynamics dependencies. So this
is not trully staticaly linked.

BTW: I hope you use the most powerfully CGI binding available:
My own, which works fine. It is actually written in Pascal
(FreePascal), but I do not want to use it anymore (no more FreePascal,
and no more Pascal).


gautier_niou...@xxxxxxxxxxx wrote
Short answer: the fixed cost is big, but if your source grows beyond
"Hello world", the binary growth is very decent, of course with the
appropriate options.
Yes, you are right in some way, and I had my self written the same in
a french forum. But the world in not only made of big applications,
and some are small, while beeing still needed.

Long answer: see newsgroups archives!
Already done, and I did not find anything useful to me.

Pascal Obry wrote :
Yes and this is called: runtime.
I know what a runtime is, but I do not understand why the one coming
with GAT is so much big even where they are so little needs.

By the way : is there a place where one can find a lightweight
runtime ?

This was what I was looking for first, bu I did not find any at the
time.

Indeed, debated many many times...
Perhaps, but if every will stop to talk about thing which has already
been talked about, then no body will not talk about anything :p

I was expecting to come into some interesting news.

Ludovic Brenta wrote:
* compile with -Os (optimize for size)
* strip the executable maximally
Already done (even tryed witg gnatelim, which by the way seems to be
missing with MinGW).

Do not worry though that the machine executes 45 KB of instructions.
Part of the executable contains data, which you cannot reduce but
which is obviously not executable.
If it is not executed, so can I remove it in some way ?

want performance, forget GCI. GCI is probably the worst way to do
dynamic web sites and has been deprecated for the past 10 years or so.
120K or 45K or 10K CGI executables won't make a difference because the
executable files will be in the buffer cache anyway. What does make
CGI slow is creating a new process with environment variables, file
descriptors, etc. and then the necessary inter-process communications
between the web server and the scripts. And CGI does that for each
incoming HTTP request: this is bad.

The proper way is to write one executable that embeds the web server
itself. The Ada Web Server library from AdaCore was designed
specifically for this purpose. With AWS, your one executable will be
larger but much, much faster than CGI. And, since you will not launch
your application with each HTTP request but only once and leave it
running all the time, dynamic linking will be an option.

Nice advice indeed, I like this one, beceause I often think about it
(I'd better say, I often dream about it). I will love to be able to do
that, but I'm hosted on a mutualist server (not dedicated), so I have
no other choice excet to rely on the CGI interface.

At the time I'm just able to earn omething like 100$ a moth with this
site, so I cannot paid for a dedicated server, but I would like to
work on some more intereting online applications.

Anon wrote:
If you rewrite the GNAT RT Libraries system so that it only uses the
routines that you need with direct OS Interface packages you can get
a program like "Hello" down to the bare minimum of 256 bytes (1
sector on a floppy) or less. It is easy to do but for most people that
too much work.
I do not mind about writing a runtime sweeted to what I need (I will
use syscalls, thus requiring no dynamic linking, fast and small), but
I do not know how to do with the exceptions runtime. I had a look at
this :
http://www.iuma.ulpgc.es/users/jmiranda/gnat-rts/index.htm
but this not goes into enought deep detail about the way GNAT handle
exceptions.

As an exemple, if I attempt to compile with "No_Run_Time", I get an
error about a duplicate symbol which is not documented in this
document.



Pascal Obry wrote:

You must be very good to be able to develop a full Ada runtime in 256
bytes! No the problem is more about unused code elimination, this is
possible on some plate-forms with recent binutils and GCC/GNAT.
Not a full runtime of course, but a runtime with just what is needed
(mainly file I/O, memory allocation and exception support, ... the
latter beeing the one I do not know how to implement)

Tero Koskinen wrote :
Like others suggested, look at AWS. It is a fast web server, much
faster than normal http-server + CGI app combination.
As I said before, I would love to do that, but I cannot, due to the
fact that it is not a dedicated server.

Here is simple example which uses C runtime instead of Ada runtime
for output:
At the time the trouble is with exceptions

Is there a runtime with just no more than exception support ?


Well, I will have deeper look just at least to compare loading time of
a Pascal vs an Ada (GNAT) application.

If you have any other idea, do not hesitate to tell here

Read you soon friends :)

Yannick Duchêne
.



Relevant Pages

  • Re: PHP - I give up.
    ... >If all you have is the ability to upload executables via ftp and run them ... >from CGI, diagnosing faults is difficult. ... string log_name=GenerateNewLogName; ... Login in to the server, and attach to the process with gdb. ...
    (comp.programming)
  • Re: How to allow downloading of exe and bat file from frontpage website
    ... the server is trying to run them ... doing CGI and will assume so until you tell it you're not by enabled ... just scripts, not scripts and executables. ...
    (microsoft.public.inetserver.iis.security)
  • Re: Go ahead. Stop programming. This ensures you from any mistakes.
    ... The answer is we have the exceptions because preparatory work, ... in that the compiler certainly doesn't ... The macros check the condition ... The strong man's position is to create multiple executables -- an executable ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Need help with threading..
    ... the threads in the thread pool are part of the MTA apartment. ... This might not work with your out of process COM server. ... MyKindOfObject myObject = new MyKindOfObject; ... You said that they are COM executables which honestly, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: c++ web scripting
    ... > a compiler, produce an executable, put it on a server, and stroll away. ... the executables themselves are cached, not the HTML output of those ... Web server invokes the CGI handler for .cpp files, ServeCPPFile. ...
    (comp.lang.cpp)