[patch, fortran] Reduce memory usage for intrinsic masks

Thomas Koenig tkoenig@alice-dsl.net
Fri Sep 7 14:40:00 GMT 2007

On Thu, 2007-09-06 at 23:34 +0200, Dominique Dhumieres wrote:

Hi Dominique,

> Do you have any idea about the impact of this patch in term of speed?

It appears to be a win, at least on my home system.

The following program:

program main
  integer, parameter :: asize = 50000
  integer, parameter :: n = 10000
  integer :: i
  real, dimension(asize) :: a, b

  call random_number(a)
  nc = count(a>0.4)
  do i=1,n
    b(1:nc) = pack(a,a>0.4)
  end do
end program main

Without the patch:

$ time ./a.out

real    0m15.427s
user    0m14.621s
sys     0m0.060s

With the patch:

$ time ./a.out

real    0m12.558s
user    0m12.533s
sys     0m0.000s

This is on an Athlon XP 2600+.

More information about the Gcc-patches mailing list