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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3ccb707f4c91a5f2 X-Google-Attributes: gid103376,public From: ka@socrates.hr.att.com (Kenneth Almquist) Subject: Re: Java vs Ada 95 (Was Re: Once again, Ada absent from DoD SBIR solicitation) Date: 1996/10/29 Message-ID: <554c5d$4ag@nntpa.cb.lucent.com>#1/1 X-Deja-AN: 193138843 references: <325BC3B3.41C6@hso.link.com> organization: Lucent Technologies, Columbus, Ohio newsgroups: comp.lang.ada Date: 1996-10-29T00:00:00+00:00 List-Id: eachus@spectre.mitre.org (Robert I. Eachus) wrote: > More of a confirmation if anything... The result of other > decisions was that Ada 95 did not require GC, but it did require all > compilers to support an unbounded string type that is (implicitly) > required to be garbage collecting (see A.4.5(88)). Most of us > considered this to be a good trade: no distributed overhead, and the > one type where GC was necessary provided with GC. There may be no distributed overhead, but there certainly is overhead. Here are some numbers from a toy benchmark: Ada with Unbounded_String: 10.02 seconds Icon (interpreted): 1.45 seconds The Icon translator I used to get the above number performs *no* optimizations whatsoever. It produces byte codes which are interpreted. There are no type declarations in Icon, so every time a value is used its type must be checked at run time. Simple integer code compiled using GNAT runs 400 times faster than the equivalent Icon code. Never the less, Icon beats GNAT by a factor of 7 on the string code shown at the end of this article. I suspect that automatic garbage collection is required to implement unbounded strings efficiently. In Icon, the assignment "b := a" can be performed by simply copying a pointer. Kenneth Almquist ---------------------------------------------------------------------- Details of benchmark numbers: The Ada code was compiled using GNAT 3.05 in -O2 mode, and the Icon code was run using version 8.10 of the interpreter from the University of Arizona. Test system: 90 Mhz Pentium on a Plato motherboard, running the Linux operating system. -- Version 1: Ada with Unbounded_String: with ada.strings.unbounded, ada.text_io; use ada.strings.unbounded, ada.text_io; procedure str_speed is a, b, c: unbounded_string; begin a := to_unbounded_string("abcdefghijklmnopqrstuvwxyz"); b := to_unbounded_string("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); for i in 1 .. 40_000 loop c := b & a & b; b := a; a := to_unbounded_string(slice(c, 1, 26)); end loop; put_line(to_string(c)); end str_speed; # Version 2: Icon procedure main() local a, b, c, i a := "abcdefghijklmnopqrstuvwxyz" b := "ABCDEFGHIJKLMNOPQRSTUVWXYZ" every i := 1 to 40000 do { c := b || a || b; b := a; a := c[1 : 27]; } write(c) end