https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77278

--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Here's a test case which shows a performance loss with LTO-enabled
libgfortran.

program main
  implicit none
  integer, parameter :: n=10**7
  integer :: i
  real, dimension(n) :: a
  real :: t1, t2, t3
  call random_number(a)
  call cpu_time(t1)
  write (20,'(E17.12)') a
  call cpu_time(t2)
  write (21,'(E17.12)') (a(i),i=1,n)
  call cpu_time(t3)
  write (*,*) 'array write: ', t2-t1
  write (*,*) 'implied write: ', t3-t2
end program main

Running three times with shared libraries:
 array write:    12.0480003    
 implied write:    11.8389988    
 array write:    12.5640001    
 implied write:    12.5340004    
 array write:    11.8710003    
 implied write:    12.1729994  

Running three times with LTO:
 array write:    14.9330006    
 implied write:    15.3499994    
 array write:    14.2670002    
 implied write:    14.8539991    
 array write:    13.7550001    
 implied write:    14.8719997  

So, it is not always all that clear.

Reply via email to