Subject: [PATCH/RFC/GSoC 01/17] perf: introduce performance tests for git-rebase

From: Paul Tan <[email-masked]>
Date: Sat, 12 Mar 2016 18:46:21 +0800

To determine the speedup (or slowdown) of the upcoming git-rebase
rewrite to C, add a simple performance test for each of the 3 git-rebase
backends (am, merge and interactive).

Signed-off-by: Paul Tan <[email-masked]>
---
 t/perf/p3400-rebase.sh             | 25 +++++++++++++++++++++++++
 t/perf/p3402-rebase-merge.sh       | 25 +++++++++++++++++++++++++
 t/perf/p3404-rebase-interactive.sh | 26 ++++++++++++++++++++++++++
 3 files changed, 76 insertions(+)
 create mode 100755 t/perf/p3400-rebase.sh
 create mode 100755 t/perf/p3402-rebase-merge.sh
 create mode 100755 t/perf/p3404-rebase-interactive.sh

diff --git a/t/perf/p3400-rebase.sh b/t/perf/p3400-rebase.sh
new file mode 100755
index 0000000..f172a64
--- /dev/null
+++ b/t/perf/p3400-rebase.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+test_description="Tests rebase performance with am backend"
+
+. ./perf-lib.sh
+
+test_perf_default_repo
+test_checkout_worktree
+
+# Setup a topic branch with 50 commits
+test_expect_success 'setup topic branch' '
+	git checkout -b perf-topic-branch master &&
+	for i in $(test_seq 50); do
+		test_commit perf-$i file
+	done &&
+	git tag perf-topic-branch-initial
+'
+
+test_perf 'rebase --onto master^' '
+	git checkout perf-topic-branch &&
+	git reset --hard perf-topic-branch-initial &&
+	git rebase --onto master^ master
+'
+
+test_done
diff --git a/t/perf/p3402-rebase-merge.sh b/t/perf/p3402-rebase-merge.sh
new file mode 100755
index 0000000..b71ce12
--- /dev/null
+++ b/t/perf/p3402-rebase-merge.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+test_description="Tests rebase performance with merge backend"
+
+. ./perf-lib.sh
+
+test_perf_default_repo
+test_checkout_worktree
+
+# Setup a topic branch with 50 commits
+test_expect_success 'setup topic branch' '
+	git checkout -b perf-topic-branch master &&
+	for i in $(test_seq 50); do
+		test_commit perf-$i file
+	done &&
+	git tag perf-topic-branch-initial
+'
+
+test_perf 'rebase -m --onto master^' '
+	git checkout perf-topic-branch &&
+	git reset --hard perf-topic-branch-initial &&
+	git rebase -m --onto master^ master
+'
+
+test_done
diff --git a/t/perf/p3404-rebase-interactive.sh b/t/perf/p3404-rebase-interactive.sh
new file mode 100755
index 0000000..aaca105
--- /dev/null
+++ b/t/perf/p3404-rebase-interactive.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+test_description="Tests interactive rebase performance"
+
+. ./perf-lib.sh
+. "$TEST_DIRECTORY"/lib-rebase.sh
+
+test_perf_default_repo
+test_checkout_worktree
+
+# Setup a topic branch with 50 commits
+test_expect_success 'setup topic branch' '
+	git checkout -b perf-topic-branch master &&
+	for i in $(test_seq 50); do
+		test_commit perf-$i file
+	done &&
+	git tag perf-topic-branch-initial
+'
+
+test_perf 'rebase -i --onto master^' '
+	git checkout perf-topic-branch &&
+	git reset --hard perf-topic-branch-initial &&
+	GIT_SEQUENCE_EDITOR=: git rebase -i --onto master^ master
+'
+
+test_done
-- 
2.7.0