Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ada Outperforms Assembly: A Case Study (gwu.edu)
58 points by todsacerdoti on July 15, 2023 | hide | past | favorite | 43 comments


Nowadays CPU pipelining is the norm, so all serious optimizers have to do instruction scheduling. Beating naive assembly written for one instruction after another, is not novel any more.


Can you write pipelines asm / schedule instructions with custom asm code ?


Somebody has to come up with the intended results of the optimization for certain chips and the actual benchmarks in the first place. So they do write assembly and test various things.

However, that person probably have extensive experience in that narrow set of problems. Most programmers don't.


With the right feedback cycle with the appropriate debug counters, absolutely.


There are still jobs where you end up writing large amounts of asm regularly and this is absolutely table-stakes for that. Otherwise there would be no point using asm at all, you’d just use C or another high-level language.

There was once a case where someone dropped from asm to machine code to shave a little more performance off. Sometimes asm is too high-level.


I feel like disabling all the error checking is a significant change for comparing performance, because the phrasing implies removal of bounds checks, etc that can be significant.

That aside a 2x performance improvement speaks to something algorithmic rather than the canonical "sufficiently intelligent compiler" - does anyone have the before/after source for this "study" (Obviously it does matter that algorithmic improvements may be easier in a higher level language, but that is likely truer for any high level language vs assembly)


> With the exception of the 1996 update note below, this article is reprinted from the Proceedings of TRI-Ada '92, Orlando, FL, November 16-20, Association for Computing Machinery (ACM), New York, 1992.


Needs a (1992) — time of original publication — or (1996) — time of last update.


Does anyone use Ada in 2023? Back in college (~2008), I had a prof who was obsessed with it but AFAIK almost nobody used it even back them.



>> Does anyone use Ada in 2023?

https://www.adacore.com/industries

Ada is used for situations where the code has to work or people die.

That makes it niche compared to other programming languages where it is okay to "panic" or "fail fast".

Different tools for different needs.


> Ada is used for situations where the code has to work or people die.

C/C++/Java/JavaScript/Python/etc. are used in situations where code doesn't have to be reliable, secure, or correct.

If customers actually cared about any of those things then our favorite tech companies wouldn't be worth zillions of dollars.


I am a big proponent of having proper liabilities across the industry, just like any other industry.

As a software enginneer professor of mine would joke, general computing quality is akin to buying a pair of shoes that randomly blow up if tied incorrectly, and people have been educated to put up with it.

With any other industry, if one buys something that doesn't properly work, usually the first reaction is to return to the shop and ask for the money back.

Thankfully digital stores, warranty contracts in project delivery, and ongoing cybersecurity laws, are already some steps into the right direction, yet there is still too much to be done.


    EULA: By using this product, you (user) agree that:
    1. It might kill your dog, and it will be your fault.
    2. Any other harm or defects will be your fault as well.
    3. You abandon all rights to sue us, ever, for anything.
    4. Any dispute will be handled by our arbitration department.
    5. We are free to spy on you and share all information with 
       our marketing partners or anyone else who asks.


C is used in situations where choose doesn't have to be reliable - wanna expand?

In my superficial understanding of computers, Linux is the paragon of reliability, so naively I would say that shows that C is good enough. However, in also aware that some instructions don't have such a great view of Linux, but I don't know much.


Linux: written in C, hundreds of buffer overflow errors

Multics: written in PL/I, approximately zero buffer overflow errors

see also: https://www.cvedetails.com/product/47/Linux-Linux-Kernel.htm...


That doesn't tell me much. Linux is much bigger and more used than whatever multics is. So the fact that more bugs are documented is no surprise.


It should tell you that Linux is not a "paragon of reliability" unless you have a non-standard definition of paragon and/or reliability.


And that many of Linux's severe vulnerabilities were facilitated by C/gcc:

"The net result is that a PL/I programmer would have to work very hard to program a buffer overflow error, while a C programmer has to work very hard to avoid programming a buffer overflow error."

https://www.acsac.org/2002/papers/classic-multics.pdf


Aerospace, defense, and safety critical systems still use it. It's less common these days but still out there. Ada 2012 is pretty nice if you're going to be writing imperative/procedural code anyways.


I worked for a defensive contractor in the early 2000s. We had MS2 and ATC programs in our facility. Anything that had to do with the operations of ATC was written in ADA. Almost all the guys I worked with went to school at Embry Riddle. Pretty sure those systems are still written in ADA.


> It's less common these days

Was Ada replaced by something else? What do they use?


I'm not sure "replaced" so much as "didn't grow" or "didn't grow as fast". Even in the 90s when the US DOD mandated Ada it wasn't used universally in defense projects because people got waivers for it. As the number of projects grow if Ada's not growing as fast as the others in adoption then it's getting a smaller and smaller share of the market. C and C++ took a lot of the marketshare in newer developments and rewrites of older Fortran, JOVIAL, and assembly systems.

So as a percentage of the market in the aerospace, defense, and safety space it has shrunk. In absolute numbers, I'm not sure if there are more or fewer systems developed and currently being maintained in it than 20 or 25 years ago. But C and C++ have definitely grown in that space.


Thanks, the usual sentiment with C and C++ is that it's unsafe to make anything beyond a hello world. Happy to hear that defense is using them. Last time I had to write Ada was in university!



I graduated recently and my first project out of college was in Ada. It was defense-related. I have also heard rumors of banks still having some ada code.

My impression of the language is that it is a lot close to C than other languages like Java or Rust.


The latest version of the Ada standard came out in 2022. It has its own package manager similar to Cargo and I'm actively working in Ada. Favorite language.


I work for a bank in Europe, and we have a large Ada project that does a lot of number crunching and is extensively depended on.


The GHDL compiler/simulator is written in ada. I suppose this makes sense since VHDL shares a lot of syntax with Ada


In France I did learn Ada at computer science school. Maybe because it is useful for the aerospace and aviation industry ? Or because teachers were used to it and deemed it was great to learn programming in a rigorous manner.

I have to say at least when you're coding in Ada there is no ideological fights over functional programming or silly design patterns from OOP. Refreshing.


The ideological fight that occurred at my job where the project was in Ada was that the most senior programmer didn't want to use git.


...What does Version Control System have to do with choice of programming lang?

Do I even want an answer?


There is, unfortunately, a cohort for which no other version control system is allowed to exist and git is somehow the final answer.


Be that as it may, The relation to Ada is confounding


My point was that even though we didnt have to worry about what things like OOP or FP ideological stuff still crept in.


The same question can be asked about many languages that are very actively used. Just not by web army.

From my personal experience - I use many languages and I mostly base my choice on perceived ROI for particular project / situation. I could not give a flying fuck if "anyone still uses those in 2023" .


ROI is substantially influenced by the ecosystem; the more libraries and documentation are published, the better the ROI.


Also ability to hire or train people fast enough. It should not be your only consideration but it should be factored in.


I am very small and never needed more than couple at subcontractors of the same time. With the whole world being at my disposal I've had zero problems finding decent freelancers for any language.


Thanks for generic reply that could be totally wrong for particular situation


My understanding is it's used in embedded and real-time systems domains. It came out of the DoD apparently.

https://en.wikipedia.org/wiki/Ada_(programming_language)


I think it's still somewhat common in defense and safety of life type applications, and not much outside of those niches


(1992)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: