3 ms·
>> for numerical computation there is likely no faster language What does the author mean by this? How can you get faster than any other compiled language like
by lentil_soup 5y ago
>> for numerical computation there is likely no faster language
What does the author mean by this? How can you get faster than any other compiled language like C where you can check the generated assembly? Does the Fortran compiler do anything special that others don't?
- cygx 5y agoFortran forbids aliasing. This gave Fortran compilers an edge before the introduction of restrict with C99. Not sure if there still exist semantic differences affecting optimizability to this day - perhaps things related to automatic vectorization?
- jcranmer 5y agoOne big issue is that C doesn't have guard rails against overflows within an object. For example, if you have an array `int a[3][3];`, `a[0][4]` is a perfectly legal way to refer to `a[1][0]`, because it's all within the same object.
- eterevsky 5y agoIf I'm not mistaken, C has weaker guarantees over which pointers can point to what memory. It means that it has to dump the variables into memory more often to make sure that pointers dereferencing is correct.
- deleted 5y ago[deleted]
- gnufx 5y agoWith GCC (now the GNU Compiler Collection) for instance, it's the same compiler for C and Fortran, just different front ends. The statement isn't useful, anyway, as it doesn't say compiled Fortran will be faster. Given the complex type, and restrict in current C, the main feature of Fortran that might help is arrays.