You could try slurping the file in one go instead of reading them in 4 byte increments.
In my experience this can speed up processing.
Unless, of course, your .gds files are so big that they don't fit in memory.