diff mbox series

[v2,17/16] t3427: accelerate this test by using fast-export and fast-import

Message ID 20190904214048.29331-1-newren@gmail.com (mailing list archive)
State New, archived
Headers show
Series rebase -r: support merge strategies other than recursive | expand

Commit Message

Elijah Newren Sept. 4, 2019, 9:40 p.m. UTC
fast-export and fast-import can easily handle the simple rewrite that
was being done by filter-branch, and should be faster on systems with a
slow fork.  Measuring the overall time taken for all of t3427 (not just
the difference between filter-branch and fast-export/fast-import) shows
a speedup of about 5% on Linux and 11% on Mac.

Signed-off-by: Elijah Newren <newren@gmail.com>
---
This patch is meant to be added onto the end of js/rebase-r-strategy; an
earlier version of this patch conflicted js/rebase-r-strategy so now I'm
basing on top of that series.  The speedup is also less impressive now
that there is only one filter-branch invocation being replaced instead of
a handful.  Still a nice speedup, though.

 t/t3427-rebase-subtree.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Johannes Schindelin Sept. 9, 2019, 8:29 p.m. UTC | #1
Hi Elijah,

On Wed, 4 Sep 2019, Elijah Newren wrote:

> fast-export and fast-import can easily handle the simple rewrite that
> was being done by filter-branch, and should be faster on systems with a
> slow fork.  Measuring the overall time taken for all of t3427 (not just
> the difference between filter-branch and fast-export/fast-import) shows
> a speedup of about 5% on Linux and 11% on Mac.
>
> Signed-off-by: Elijah Newren <newren@gmail.com>
> ---
> This patch is meant to be added onto the end of js/rebase-r-strategy; an
> earlier version of this patch conflicted js/rebase-r-strategy so now I'm
> basing on top of that series.  The speedup is also less impressive now
> that there is only one filter-branch invocation being replaced instead of
> a handful.  Still a nice speedup, though.

ACK!

Thanks,
Dscho

>
>  t/t3427-rebase-subtree.sh | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/t/t3427-rebase-subtree.sh b/t/t3427-rebase-subtree.sh
> index 39e348de16..bec48e6a1f 100755
> --- a/t/t3427-rebase-subtree.sh
> +++ b/t/t3427-rebase-subtree.sh
> @@ -59,7 +59,10 @@ test_expect_success 'setup' '
>  	test_commit files_subtree/master5 &&
>
>  	git checkout -b to-rebase &&
> -	git filter-branch --prune-empty -f --subdirectory-filter files_subtree &&
> +	git fast-export --no-data HEAD -- files_subtree/ |
> +		sed -e "s%\([0-9a-f]\{40\} \)files_subtree/%\1%" |
> +		git fast-import --force --quiet &&
> +	git reset --hard &&
>  	git commit -m "Empty commit" --allow-empty
>  '
>
> --
> 2.22.0.19.ga495766805
>
>
Junio C Hamano Sept. 9, 2019, 9:06 p.m. UTC | #2
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> Hi Elijah,
>
> On Wed, 4 Sep 2019, Elijah Newren wrote:
>
>> fast-export and fast-import can easily handle the simple rewrite that
>> was being done by filter-branch, and should be faster on systems with a
>> slow fork.  Measuring the overall time taken for all of t3427 (not just
>> the difference between filter-branch and fast-export/fast-import) shows
>> a speedup of about 5% on Linux and 11% on Mac.
>>
>> Signed-off-by: Elijah Newren <newren@gmail.com>
>> ---
>> This patch is meant to be added onto the end of js/rebase-r-strategy; an
>> earlier version of this patch conflicted js/rebase-r-strategy so now I'm
>> basing on top of that series.  The speedup is also less impressive now
>> that there is only one filter-branch invocation being replaced instead of
>> a handful.  Still a nice speedup, though.
>
> ACK!
>
> Thanks,
> Dscho

Thanks, both.  This indeed is a good update.

>
>>
>>  t/t3427-rebase-subtree.sh | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/t/t3427-rebase-subtree.sh b/t/t3427-rebase-subtree.sh
>> index 39e348de16..bec48e6a1f 100755
>> --- a/t/t3427-rebase-subtree.sh
>> +++ b/t/t3427-rebase-subtree.sh
>> @@ -59,7 +59,10 @@ test_expect_success 'setup' '
>>  	test_commit files_subtree/master5 &&
>>
>>  	git checkout -b to-rebase &&
>> -	git filter-branch --prune-empty -f --subdirectory-filter files_subtree &&
>> +	git fast-export --no-data HEAD -- files_subtree/ |
>> +		sed -e "s%\([0-9a-f]\{40\} \)files_subtree/%\1%" |
>> +		git fast-import --force --quiet &&
>> +	git reset --hard &&
>>  	git commit -m "Empty commit" --allow-empty
>>  '
>>
>> --
>> 2.22.0.19.ga495766805
>>
>>
diff mbox series

Patch

diff --git a/t/t3427-rebase-subtree.sh b/t/t3427-rebase-subtree.sh
index 39e348de16..bec48e6a1f 100755
--- a/t/t3427-rebase-subtree.sh
+++ b/t/t3427-rebase-subtree.sh
@@ -59,7 +59,10 @@  test_expect_success 'setup' '
 	test_commit files_subtree/master5 &&
 
 	git checkout -b to-rebase &&
-	git filter-branch --prune-empty -f --subdirectory-filter files_subtree &&
+	git fast-export --no-data HEAD -- files_subtree/ |
+		sed -e "s%\([0-9a-f]\{40\} \)files_subtree/%\1%" |
+		git fast-import --force --quiet &&
+	git reset --hard &&
 	git commit -m "Empty commit" --allow-empty
 '