Re: [PATCH 8/9] perl: lazily load some common Git.pm setup code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> wrote:
> @@ -408,10 +404,12 @@ sub command_bidi_pipe {
>  	my $cwd_save = undef;
>  	if ($self) {
>  		shift;
> -		$cwd_save = cwd();
> +		require Cwd;
> +		$cwd_save = Cwd::cwd();
>  		_setup_git_cmd_env($self);

(This also applies to 7/9)

Cwd::cwd() execs /bin/pwd (at least on Perl 5.28.1 in Debian 10x).
There should be a benefit from using Cwd::getcwd() here, instead.

	strace -f -e execve perl -MCwd -E 'Cwd::cwd()

...confirms the execve is happening.

getcwd() takes 25ms vs 27ms of cwd() for me using the
"schedutil" CPU governor under Linux:

	time perl -MCwd -E 'Cwd::getcwd()'
	time perl -MCwd -E 'Cwd::cwd()'




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux