[PATCH] PR libstdc++/90634 reduce allocations in filesystem::path construction
Jonathan Wakely
jwakely@redhat.com
Tue May 28 19:43:00 GMT 2019
On 28/05/19 17:10 +0100, Jonathan Wakely wrote:
> PR libstdc++/90634
> * src/filesystem/path.cc (path::_M_split_cmpts()): Fix check for "/".
> * testsuite/27_io/filesystem/path/construct/90634.cc: New test.
> * testsuite/experimental/filesystem/path/construct/90634.cc: New test.
>
> 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.
>
>Tested x86_64-linux, committed to gcc-8-branch.
This is the simpler patch for trunk and gcc-9-branch, which only needs
to change std::experimental::filesystem::path, because
std::filesystem::path already avoids any unnecessary allocations.
Tested powerpc64le-linux and x86_64-w64-mingw32 Committed to trunk so
far, backport to follow.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 8613 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20190528/dc374891/attachment.bin>
More information about the Libstdc++
mailing list