help / color / mirror / Atom feed
From: "Jeffrey R.Carter" <>
Subject: Re: does a safer language mean it is slower to run?
Date: Thu, 8 Jun 2023 10:50:44 +0200	[thread overview]
Message-ID: <u5s4p4$1facv$> (raw)
In-Reply-To: <u5rjg8$1dr0c$>

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 

which discusses four advantages Ada (83) has over C for optimization.

See also

Ada Outperforms Assembly: A Case Study 

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

  parent reply	other threads:[~2023-06-08  8:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-08  3:55 does a safer language mean it is slower to run? Nasser M. Abbasi
2023-06-08  6:57 ` Niklas Holsti
2023-10-25 17:01   ` robin vowels
2023-10-25 18:33     ` Niklas Holsti
2023-11-01  1:48       ` Randy Brukardt
2023-06-08  8:00 ` Dmitry A. Kazakov
2023-06-08 22:32   ` Jerry
2023-06-10 12:33     ` Gautier write-only address
2023-06-08  8:50 ` Jeffrey R.Carter [this message]
2023-06-08 15:19 ` Luke A. Guest
2023-08-03 20:42   ` Kevin Chadwick
2023-09-29 19:23 ` Shark8
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox