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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,539c04254abf1b37 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-03-01 15:17:57 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: andreatta@mail.chem.sc.edu (Dan Andreatta) Newsgroups: comp.lang.ada Subject: Re: compiler benchmark comparisons Date: 1 Mar 2002 15:17:56 -0800 Organization: http://groups.google.com/ Message-ID: <338040f8.0203011517.5a1ebdeb@posting.google.com> References: <3C74E519.3F5349C4@baesystems.com> <3C7D37FD.F67F7067@despammed.com> <17247c3d.0202271553.68aaf78d@posting.google.com> <338040f8.0202271819.373f733a@posting.google.com> <338040f8.0202281012.31593a2@posting.google.com> <5ee5b646.0202282107.6f3dd89a@posting.google.com> NNTP-Posting-Host: 129.252.151.109 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1015024677 26761 127.0.0.1 (1 Mar 2002 23:17:57 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 1 Mar 2002 23:17:57 GMT Xref: archiver1.google.com comp.lang.ada:20674 Date: 2002-03-01T23:17:57+00:00 List-Id: > examples like this in detail, we discover that what > people think are "identical" programs are in fact totally different Er... you are right. (At this time Google hasn't reported any reply). I did some more experiments, and the bottleneck for the compiler was in the genration of the code for Integer'Image(). I modified the loop, and now it look more like the C version, relying on the I/O library (using Ada.Integer_Text_IO). Amazingly, now it compiles in about 2 seconds. Summarizing, these are the data (below are the fragments of the codes used): GNU/C GNU/Ada (1) GNU/Ada (2) GNU/Ada (3) Source size (kB) 45 82 103 97 Object size (kB) 63 503 503 109 time to compile (s) 1.4 11.0 8.0 2.2 compiled with gcc -c file.adb (no switches) In conclusion... draw your own conclusion. Memo for me: next time don't spare resources, use at lest 2 neurons :-) The codes for the loops (repeated 1000 times) were: GNU/C for (i=0; i<100; ++i) printf("%d\n",i); GNU/Ada (1) for i in 1..100 loop ada.text_io.put_line( Integer'Image(i) ); end loop; GNU/Ada (2) i := 0; while i<100 loop ada.text_io.put_line( Integer'Image(i) ); end loop; GNU/Ada (3) for i in 1..100 loop ada.integer_text_io.put( i ); ada.text_io.new_line; end loop;