https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90634
--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> --- Author: redi Date: Tue May 28 14:57:35 2019 New Revision: 271710 URL: https://gcc.gnu.org/viewcvs?rev=271710&root=gcc&view=rev Log: PR libstdc++/90634 reduce allocations in filesystem::path construction PR libstdc++/90634 * include/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. * include/experimental/bits/fs_path.h: Likewise. * 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. * src/filesystem/std-path.cc (path::_M_split_cmpts()): Likewise. Modified: branches/gcc-8-branch/libstdc++-v3/ChangeLog branches/gcc-8-branch/libstdc++-v3/include/bits/fs_path.h branches/gcc-8-branch/libstdc++-v3/include/experimental/bits/fs_path.h branches/gcc-8-branch/libstdc++-v3/src/filesystem/path.cc branches/gcc-8-branch/libstdc++-v3/src/filesystem/std-path.cc