[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Suitability of Lua as a First Programming Language?
- From: Miles Bader <miles@...>
- Date: Tue, 04 Dec 2012 13:35:54 +0900
Coda Highland <chighland@gmail.com> writes:
>> I have read many times that FORTRAN is better Than C for number
>> crunching buy I do not know WHY?
>
> Long story short, it's actually not. Once upon a time, it was, when C
> was a systems programming language and FORTRAN was explicitly created
> for mathematics. Now, not so much -- with the GNU tools, both
> languages compile down to essentially the same thing and are
> essentially equivalent in performance.
Hmm, I seem to recall that fortran programs benefit from different
language rules regarding aliasing, such that a fortran compiler can
ignore potential aliasing in situations where a C compiler can not.
Aliasing issues can be a significant problem for optimizers, so this
additional freedom can result in better optimization. This is
especially the case with a lot of matrix-heavy math codes.
Now, given the degree to which fortran and C compilers often share
infrastructure these days, I don't know the degree to which optimizers
actually make good use of this additional freedom, but it is a
potential benefit, and it's certainly possible to take advantage of
it, even in a multiple language compiler.
-Miles
--
.Numeric stability is probably not all that important when you're guessing.