From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.2 required=3.0 tests=BAYES_00,NICE_REPLY_A, T_SCC_BODY_TEXT_LINE,URI_DOTEDU autolearn=no autolearn_force=no version=3.4.6 Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R.Carter" Newsgroups: comp.lang.ada Subject: Re: does a safer language mean it is slower to run? Date: Thu, 8 Jun 2023 10:50:44 +0200 Organization: A noiseless patient Spider Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 8 Jun 2023 08:50:45 -0000 (UTC) Injection-Info: dont-email.me; posting-host="eec3476987453bbce272b9fdedcffe1f"; logging-data="1550751"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+VAmlOYTFUxJeE8iiyIeCnaV1RH+wKhaI=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Cancel-Lock: sha1:z5GQppewSe2h9+oO2WBdWgMWJws= Content-Language: en-US In-Reply-To: Xref: news.eternal-september.org comp.lang.ada:65302 List-Id: On 2023-06-08 05:55, Nasser M. Abbasi wrote: > > Some in that thread seem to argue that a safer language > will/could be slower than otherwise. > > Since Ada is known to be one of the safest languages, > do others here feel there is any truth to this? Equivalent programs in compiled, non-GC languages have equivalent execution times. Robert Dewar famously had a set of equivalent Ada and C programs that produced identical machine code when compiled with gcc. So this is false. The problem is getting equivalent programs. If the safe language includes run-time checks, then equivalent checks must be manually added to the unsafe language. Ada.Text_IO is not equivalent to C's I/O facilities. And so on. Once consequence of this is that both programs will be equally correct. What is usually compared is a correct (run-time checks) program in the safe language to an incorrect (no run-time checks) program in the unsafe language. About optimization, Tartan made its living selling highly optimizing C compilers for TI chips, which came with a free C compiler. They also made highly optimizing Ada compilers, which did a better job of optimization than their C compilers. This was documented in C vs Ada: arguing performance religion (https://dl.acm.org/doi/10.1145/216578.216583) which discusses four advantages Ada (83) has over C for optimization. See also Ada Outperforms Assembly: A Case Study (https://www2.seas.gwu.edu/~adagroup/sigada-website/lawlis.html) TI bought Tartan and sold its Ada compilers to DDC-I. -- Jeff Carter "Monsieur Arthur King, who has the brain of a duck, you know." Monty Python & the Holy Grail 09