[Patch, fortran] PR35339 Optimize implied do loops in io statements

Jerry DeLisle jvdelisle@charter.net
Sun May 28 22:07:00 GMT 2017


On 05/27/2017 12:49 PM, Nicolas Koenig wrote:
> Hello everyone,
> 
> attached is a patch to simplify implied do loops in io statements by replacing 
> them with their respective array slices. For example "WRITE (*,*) (a(i), 
> i=1,4,2)" becomes "WRITE (*,*) a(1:4:2)".
> 
> Ok for trunk?
> 

Thanks for patch. Could you do some timing performance tests with and without 
the patch on large arrays and see if we gain anything?

Also, we should expand the test case to include implied do loops in read 
statements. You could probably just rewind the file, copy down the WRITEs and 
change them to READs or similar and check results.

While doing some checks myself I noticed some odd behavior and found PR53029. I 
posted a patch, but what caught my attention was the implied do version was 
faster than the array version. (about .89 sec vs 6 sec)

So with my patch there I am now getting (.89 sec vs .007 sec)

This prompted me to have you check some performance cases.

Thanks for additional feedback,

Jerry




More information about the Fortran mailing list