When writing records to a direct access file I am finding that the Intel Fortran compiler is much slower than my 17 year old Watcom Fortran compiler running exactly the same code. In fact the Intel compiler is around 10 times slower!! This doesn't seem right to me. Can anyone see what I am doing wrong in the code segment below? Note that if CASES=1970 and BMS=5167, it is writing over 10 million records and this is taking around 8 minutes on my I7 laptop, whereas the ancient Watcom compiler does it in less than a minute.
You can see that I have a PeekMessage statement in the loop so that it can process Windows messages, however I am finding that the speed is the same with or without it.
Help!
INTEGER*4 RCD,CASES,BMS,CNUM,NMP,MEM,IO
STRUCTURE /MACTIONS/
INTEGER*2 NTCN,BKL
REAL*8 FM(12),Extra(6),Diff(6)
END STRUCTURE
RECORD /MACTIONS/ MACT(BMS,CASES)
TYPE(T_MSG) Msg
OPEN (MALUN,FILE='FRED.DAT'
c ,STATUS='NEW'
c ,ACCESS='DIRECT'
c ,FORM='UNFORMATTED'
c ,ACTION='READWRITE'
c ,RECL=200
c ,IOSTAT=IO)
RCD=0
DO CNUM=1,CASES
PeekMessage (Msg,0,0,0,PM_REMOVE)
DO NMP=1,BMS
RCD=RCD+1
WRITE (MALUN,REC=RCD,IOSTAT=IO) NMP
c ,(MACT(NMP,CNUM).FM(I),I=1,12)
c ,MACT(NMP,CNUM).NTCN,MACT(NMP,CNUM).BKL
c ,(MACT(NMP,CNUM).Extra(I),I=1,6)
c ,(MACT(NMP,CNUM).Diff(I),I=1,6)
ENDDO
ENDDO
CLOSE (MALUN)