[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:38:27 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94268
--- Comment #4 from fdlbxtqi <euloanty at live dot com> ---
(In reply to fdlbxtqi from comment #3)
> 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.
The most efficient one is 1048576. However, I think it should be set to at
least 65536, although 4096 can already fix most of the problems. Windows
syscall is expensive.
More information about the Gcc-bugs
mailing list