Re: forall and do loop
- From: nospam@xxxxxxxxxxxxx (Richard Maine)
- Date: Mon, 30 Jul 2007 08:45:27 -0700
*** Hendricksonsaid:
specific] optimization. The main (only?) "problem" with FORALL
is that people are surprised by the general need for temporaries
when storing.
highegg <highegg@xxxxxxxxx> wrote:
But they shouldn't be. Everyone seems to accept compiler creating
necessary temporaries when evaluating scalar expressions, and the
whole array arithmetic stuff is build around the idea of treating
arrays quite like scalars.
And strangely enough, people seem to calmly accept Matlab or Octave
making temporaries for array arithmetics all the time, but for some
reason they expect a Fortran compiler to be so ultra-mega-intelligent
and reduce the temporaries to an absolute minimum (or even below
that). Why?
It is all about speed.
Because array temporaries are slow. Scalar temporaries aren't. The main
purpose of FORALL having been to speed things up, people get surprised
when it slows them down. Matlab/Octave are notoriously slow anyway.
When the FORALL uses an array temporary, but other ways of writing the
same thing don't, then the temporary obviously isn't an absolute
minimum.
I don't expect compilers to be smart enough to eliminate the temporaries
in all FORALLs. It can be darned hard. I don't think the average user
expects it either. He/she just expects FORALL to be faster than the
alternatives, rather than slower. It usually isn't faster. Array temps
are one of the reasons, but I doubt that the user who is surprised by
the slowdown is typically even aware of the array temp issue at all.
--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
.
- References:
- forall and do loop
- From: aeroguy
- Re: forall and do loop
- From: glen herrmannsfeldt
- Re: forall and do loop
- From: aeroguy
- Re: forall and do loop
- From: *** Hendrickson
- Re: forall and do loop
- From: highegg
- Re: forall and do loop
- From: *** Hendrickson
- Re: forall and do loop
- From: highegg
- Re: forall and do loop
- From: *** Hendrickson
- Re: forall and do loop
- From: highegg
- forall and do loop
- Prev by Date: Re: forall and do loop
- Next by Date: Re: forall and do loop
- Previous by thread: Re: forall and do loop
- Next by thread: Re: forall and do loop
- Index(es):