------- Comment #14 from jvdelisle at gcc dot gnu dot org 2007-12-01 04:22 ------- This is embarrassing and good at the same time:
Index: unix.c =================================================================== --- unix.c (revision 130547) +++ unix.c (working copy) @@ -669,11 +669,8 @@ fd_seek (unix_stream * s, gfc_offset off if (s->file_length == -1) return SUCCESS; - if (s->physical_offset == offset) /* Are we lucky and avoid syscall? */ - { - s->logical_offset = offset; - return SUCCESS; - } + if (s->logical_offset == offset) /* Are we lucky and avoid syscall? */ + return SUCCESS; if (lseek (s->fd, offset, SEEK_SET) >= 0) { According to the comment we have been unlucky for a long time. :) With this simple change alone, my sequential read benchmark goes from 23 seconds to .5 seconds. There is a regression in backspace_6.f90 which implies we need to fix back space and leave the above fix in place if possible. The read test I am using is reading a 36 megabyte unformatted file with ACCESS="stream". This is impressive! My write test with same file goes from about 6 seconds to about .5 seconds as well. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33985