[Bug libstdc++/90634] filesystem::path insane memory allocations
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue May 28 19:40:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90634
--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Tue May 28 19:39:48 2019
New Revision: 271717
URL: https://gcc.gnu.org/viewcvs?rev=271717&root=gcc&view=rev
Log:
PR libstdc++/90634 reduce allocations in filesystem::path construction
PR libstdc++/90634
* include/experimental/bits/fs_path.h (path::path(path&&)): Only call
_M_split_cmpts() for a path with multiple components.
(path::_S_is_dir_sep()): Add missing 'static' keyword to function.
* src/filesystem/path.cc (path::_M_split_cmpts()): Count number of
components and reserve space in vector. Return early when there is
only one component.
* testsuite/27_io/filesystem/path/construct/90634.cc: New test.
* testsuite/experimental/filesystem/path/construct/90634.cc: New test.
Added:
trunk/libstdc++-v3/testsuite/27_io/filesystem/path/construct/90634.cc
trunk/libstdc++-v3/testsuite/experimental/filesystem/path/construct/90634.cc
Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/experimental/bits/fs_path.h
trunk/libstdc++-v3/src/filesystem/path.cc
More information about the Gcc-bugs
mailing list