Possible Code Performance Disparity using "parameter"

Steve Kargl sgk@troutmask.apl.washington.edu
Tue Mar 13 02:48:00 GMT 2012


On Mon, Mar 12, 2012 at 08:45:12PM -0400, John L. Males wrote:
> 
> I am not a compiler developer or like, but have some sense from
> days gone by of compilers and assemblers I often fixed bugs in
> or made major changes to.  Suffice to say I know alot has
> changed since then.
> 
> I know the "parameter" statement is as you stated when reporting
> this as a possible issue.  I believe some of the possible
> reasons you have stated may be the reason for the difference in
> run time of the generated code.  What I am not so sure is if
> the nature of the difference, i.e. the variable that is still
> only used as a constant and never changed after reading the
> value from a command line argument is sufficient to justify the
> difference in code generation.
> 
> The code in the program that consumes the CPU time is actually
> very simple.  The code is a unique algorithm of 19 lines - one
> "do while" with three serial (unnested do's) within the "do
> while" of which one "do" has an "if" statement within. This
> noted code is the meat of the program.  Following this noted
> code the program prints a line or two of a couple numbers then
> exits.  The logic before the noted code is just to print some
> static text, the values of the constants and prime a very small
> array with values. The constant/variable in question is
> set/read from the command line prior the noted code that is the
> problem depending on if it is a constant or variable.
> 
> I will try to create a sample test program that will duplicate
> the problem. I know and understand code that demonstrates the
> problem will enable you to better access the concern and if
> there is a possible opportunity to improve the gcc/gfortran
> code generation.
> 
> I will see if I can find other Fortran compilers which I can
> try with my code as well sample code I will try to write that
> duplicates the issue.
> 
> Do I reply back to you and cc <mailtofortran@gcc.gnu.org> or do
> I just reply to <fortran@gcc.gnu.org> with the sample test code
> attached?

Reply-to-all.

Also note that telling us what the problem is or
trying to develop sample code is a lot more work
than showing us the actual code.  If you think it
is too large for the list, post a URL to the code.

If you want to look under th hood, try comparing 
the files generated with -fdump-tree-original
and -fdump-tree-optimized.  This will give a
C-like intermediate representation.

-- 
Steve



More information about the Fortran mailing list