3 ms·
In theory, it's just as fast as C/C++, when you compare GNAT against GCC/G++. In practice, some language constructs are not as optimized as their C++ counterpa
by Raphael_Amiard 9y ago
In theory, it's just as fast as C/C++, when you compare GNAT against GCC/G++.
In practice, some language constructs are not as optimized as their C++ counterpart.
The end result is that you can expect the Ada 83 subset to be extremely fast, but more recent constructs like OO and controlled types (equivalent to C++ virtual destructors) to be slower.
All in all it has a pretty good performance story !
- flukus 9y ago> In theory, it's just as fast as C/C++, when you compare GNAT against GCC/G++. Is this the same theory that makes java is just as fast? Ie, if I wrote idiomatic Ada would the levels of indirection (pointers to pointers to pointers and virtual functions everywhere) by more like c or more like java?
- Raphael_Amiard 9y agoWell, yes and no :) Ada is very close to C++ in terms of runtime abstraction, unlike Java, so it's not relying so much on the "sufficiently smart compiler" fallacy. Also, there are several idiomatic dialects of Ada, because Ada has a facility to deactivate language features at compile time. Some people in safety critical don't want any dispatch for example. FWIW I ported a quite large code base from C++ to Ada so I'm have first hand experience with this.