http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47694
--- Comment #11 from Janne Blomqvist <jb at gcc dot gnu.org> 2011-02-15 09:42:12 UTC --- Unfortunately I don't think I'll have time to look into it this week. As can be seen from Tobias patch, reading one character at a time is very slow. But, the comment in read_sf() is wrong, it's not actually needed to read one character at a time; what we need to do is to handle short reads correctly. One fix, I suspect, would be to convert read_sf() to use fbuf_getc() instead, which gives the impression of reading a character at a time, even though fbuf takes care of doing buffered reads in the background. But in order to do that, the read_sf() API needs to be changed so that a buffer is passed as an argument, and this buffer is then filled with data, rather than returning a pointer to the fbuf buffer.