This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] PR libstdc++/90634 reduce allocations in filesystem::path construction


	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.


Attachment: patch-gcc8.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]