[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 12:29:07 GMT 2020


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

--- Comment #7 from fdlbxtqi <euloanty at live dot com> ---
I rebuilt a new GCC with this patch. The performance improves for 10 times for
output integer. 3 times for input integer. Definitely worth it.

D:\hg\w4\f8\fast_io\benchmarks\0000.10m_size_t\unit>gcc --version
gcc (master HEAD with MCF thread model, built by cqwrteur.) 10.0.1 20200323
(experimental)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

D:\hg\w4\f8\fast_io\benchmarks\0000.10m_size_t\unit>g++ -o filebuf_io_observer
filebuf_io_observer.cc -Ofast -std=c++2a -s

D:\hg\w4\f8\fast_io\benchmarks\0000.10m_size_t\unit>filebuf_io_observer
output: 0.047s
input:  0.085998s

D:\hg\w4\f8\fast_io\benchmarks\0000.10m_size_t\unit>g++ -o filebuf_io_observer
filebuf_io_observer.cc -Ofast -std=c++2a -s -flto

D:\hg\w4\f8\fast_io\benchmarks\0000.10m_size_t\unit>filebuf_io_observer
output: 0.042999s
input:  0.086012s


Ther performance is now nearly as good as my buffer implementation. Though it
is still slower due to hacking. It is actually usable.
g++ -o iobuf_file iobuf_file.cc -Ofast -std=c++2a -s -flto


./iobuf_file.exe
output: 0.044000000000000004s
input:  0.076s


More information about the Gcc-bugs mailing list