From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: * X-Spam-Status: No, score=1.1 required=5.0 tests=BAYES_00,INVALID_MSGID, TO_NO_BRKTS_PCNT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1bce3f54cf1cba1b,start X-Google-Attributes: gid103376,public From: geert@fozzie.sun3.iaf.nl (Geert Bosch) Subject: GNAT Executables: How low can you go? Date: 1996/04/13 Message-ID: <4kmq7a$egm@fozzie.sun3.iaf.nl>#1/1 X-Deja-AN: 147270881 organization: La Calandre Infortunee newsgroups: comp.lang.ada Date: 1996-04-13T00:00:00+00:00 List-Id: Boring stuff ~~~~~~~~~~~~ Last week I've done a rewrite of a full featured regular expression matcher (the one that comes with EMX) for Ada. The C-version was awkward to use because of the need of a terminating NUL character, bad error handling and use of global variables which makes tasking nearly impossible. The final RE matcher is 55 kB of source (I guess just 15% comments) and 1600 lines and doesn't need dynamic memory allocation. This is better... ~~~~~~~~~~~~~~~~~ Using GNAT v3.01 for OS/2 and default compilation, but with optimizations on and checks suppressed resulted in an executable of 114 kB which ran about 3 times as slow as the C version. Now with some tweaking the source has changed a little (about 20 lines were modified) and now the code is just 15-20% slower than the C version which is not bad considering the extra robustness and safety. And now the GOOD news! ~~~~~~~~~~~~~~~~~~~~~~ The complete application which also produces debug information about the regular expression and which dumps the complete statusmachine in human-readable format is only 11616 bytes in size!!! I really didn't know GNAT executables could be this small and I even used string slices, exception handlers, discriminated records containing variable-sized arrays and text-io on integers, booleans and enumeration types. There was no 'dead' code in the source and all generated code and message strings are in the 11616 byte executable. Of course I'll explain the tricks later but it's already late now. I just had to let you know how great GNAT really is. ;-) ;-) Regards, Geert Bosch -- E-Mail: geert@sun3.iaf.nl *** As far as we know, there have not been *** Phone: +31-53-4303054 ** any undetected failures in our software. **