[Bug libstdc++/94268] std::filebuf is extremely (at least 10x) slow on windows compared to Linux. Even much slower MSVC STL with terrible ABI.

euloanty at live dot com gcc-bugzilla@gcc.gnu.org
Mon Mar 23 09:36:44 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94268

--- Comment #3 from fdlbxtqi <euloanty at live dot com> ---
I have found out the reason. It is because the buffer size is too small on the
windows. BUFSIZ == 512

You need to set the value to 4096 at least. I think even 65536 is something
should be done since the windows syscall is extremely expensive. I have tested
with WriteFile, the maximum performance needs to set to 131072 buffer_size with
my library.

I think I can fix this bug easily.


More information about the Gcc-bugs mailing list