summaryrefslogtreecommitdiff
path: root/t/perf
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-10-18 22:47:56 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-10-18 22:47:56 (GMT)
commit0ef08090d2a391e0ce037eafd2b391e3f76b1060 (patch)
treee88ee06ddb6a8e3d800c34f43b87e9a2348f36c9 /t/perf
parentf443b226ca681d87a3a31e245a70e6bc2769123c (diff)
parentc90cfc225baaf64af311f7e2953267e4de636205 (diff)
downloadgit-0ef08090d2a391e0ce037eafd2b391e3f76b1060.zip
git-0ef08090d2a391e0ce037eafd2b391e3f76b1060.tar.gz
git-0ef08090d2a391e0ce037eafd2b391e3f76b1060.tar.bz2
Merge branch 'rs/mergesort'
The mergesort implementation used to sort linked list has been optimized. * rs/mergesort: test-mergesort: use repeatable random numbers mergesort: use ranks stack p0071: test performance of llist_mergesort() p0071: measure sorting of already sorted and reversed files test-mergesort: add unriffle_skewed mode test-mergesort: add unriffle mode test-mergesort: add generate subcommand test-mergesort: add test subcommand test-mergesort: add sort subcommand test-mergesort: use strbuf_getline()
Diffstat (limited to 't/perf')
-rwxr-xr-xt/perf/p0071-sort.sh40
1 files changed, 33 insertions, 7 deletions
diff --git a/t/perf/p0071-sort.sh b/t/perf/p0071-sort.sh
index 6e924f5..ed366e2 100755
--- a/t/perf/p0071-sort.sh
+++ b/t/perf/p0071-sort.sh
@@ -11,16 +11,42 @@ test_expect_success 'setup' '
git cat-file --batch >unsorted
'
-test_perf 'sort(1)' '
- sort <unsorted >expect
+test_perf 'sort(1) unsorted' '
+ sort <unsorted >sorted
'
-test_perf 'string_list_sort()' '
- test-tool string-list sort <unsorted >actual
+test_expect_success 'reverse' '
+ sort -r <unsorted >reversed
'
-test_expect_success 'string_list_sort() sorts like sort(1)' '
- test_cmp_bin expect actual
-'
+for file in sorted reversed
+do
+ test_perf "sort(1) $file" "
+ sort <$file >actual
+ "
+done
+
+for file in unsorted sorted reversed
+do
+
+ test_perf "string_list_sort() $file" "
+ test-tool string-list sort <$file >actual
+ "
+
+ test_expect_success "string_list_sort() $file sorts like sort(1)" "
+ test_cmp_bin sorted actual
+ "
+done
+
+for file in unsorted sorted reversed
+do
+ test_perf "llist_mergesort() $file" "
+ test-tool mergesort sort <$file >actual
+ "
+
+ test_expect_success "llist_mergesort() $file sorts like sort(1)" "
+ test_cmp_bin sorted actual
+ "
+done
test_done