Is it possible speed up a code like this (array of derived type)?
Thanks all
Code:
program test
USE dati_m
type(dato), target,allocatable :: dat(:)
integer, pointer :: ip(:)
real tbegin, tend
allocate(dat(65000))
ip => dat%i1
call cpu_time(tbegin)
do j=1,5000
call set(ip,j)
end do
call cpu_time(tend)
write(*,*) ' Time=',(tend-tbegin)
end program
module dati_m
type :: dato
real :: r1 = 2
integer :: i1 = 33
character(len=32) ::c1
character(len=62) ::c2
end type dato
contains
subroutine set(p,i)
integer, pointer :: p(:)
integer ::i
p(i)=p(i)+1
end subroutine set
end module dati_m
Thanks all