[PATCH v2 1/2] libstdc++: also use sendfile for big files

Jonathan Wakely jwakely@redhat.com
Mon Mar 20 22:30:24 GMT 2023


On 20/03/23 22:27 +0000, Jonathan Wakely wrote:
>On 06/03/23 20:52 +0100, Jannik Glückert wrote:
>>we were previously only using sendfile for files smaller than 2GB, as
>>sendfile needs to be called repeatedly for files bigger than that.
>>
>>some quick numbers, copying a 16GB file, average of 10 repetitions:
>>   old:
>>       real: 13.4s
>>       user: 0.14s
>>       sys : 7.43s
>>   new:
>>       real: 8.90s
>>       user: 0.00s
>>       sys : 3.68s
>>
>>Additionally, this fixes
>>https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108178
>>
>>libstdc++-v3/ChangeLog:
>>
>>       * acinclude.m4 (_GLIBCXX_HAVE_LSEEK): define
>>       * config.h.in: Regenerate.
>>       * configure: Regenerate.
>>       * src/filesystem/ops-common.h: enable sendfile for files
>>         >2GB in std::filesystem::copy_file, skip zero-length files

Also, the ChangeLog entry needs to be indented with tabs, name the
changed functions, and should be complete sentences, e.g.

	* acinclude.m4 (_GLIBCXX_HAVE_LSEEK): Define.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* src/filesystem/ops-common.h (copy_file_sendfile): Define new
	function for sendfile logic. Loop to support large files. Skip
	zero-length files.
	(do_copy_file): Use it.




More information about the Libstdc++ mailing list