git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v7 4/5] p7300: add performance tests for clean

From
Erik Elfström <erik.elfstrom@gmail.com>
Date
Jun 9, 2015, 18:24 UTC
Message-ID
<1433874279-30720-5-git-send-email-erik.elfstrom@gmail.com>
In-Reply-To
<1433874279-30720-1-git-send-email-erik.elfstrom@gmail.com>

The tests are run in dry-run mode to avoid having to restore the test directories for each timed iteration. Using dry-run is an acceptable compromise since we are mostly interested in the initial computation of what to clean and not so much in the cleaning it self.

Signed-off-by: Erik Elfström <erik.elfstrom@gmail.com>
---
 t/perf/p7300-clean.sh | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100755 t/perf/p7300-clean.sh
diff --git a/t/perf/p7300-clean.sh b/t/perf/p7300-clean.sh
new file mode 100755
index 0000000..ec94cdd
--- /dev/null
+++ b/t/perf/p7300-clean.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+test_description="Test git-clean performance"
+
+. ./perf-lib.sh
+
+test_perf_default_repo
+test_checkout_worktree
+
+test_expect_success 'setup untracked directory with many sub dirs' '
+	rm -rf 500_sub_dirs 100000_sub_dirs clean_test_dir &&
+	mkdir 500_sub_dirs 100000_sub_dirs clean_test_dir &&
+	for i in $(test_seq 1 500)
+	do
+		mkdir 500_sub_dirs/dir$i || return $?
+	done &&
+	for i in $(test_seq 1 200)
+	do
+		cp -r 500_sub_dirs 100000_sub_dirs/dir$i || return $?
+	done
+'
+
+test_perf 'clean many untracked sub dirs, check for nested git' '
+	git clean -n -q -f -d 100000_sub_dirs/
+'
+
+test_perf 'clean many untracked sub dirs, ignore nested git' '
+	git clean -n -q -f -f -d 100000_sub_dirs/
+'
+
+test_done
-- 
2.4.3.373.gc496bfb
Previous: Erik ElfströmNext: Erik Elfström
Message 8 of 9 in “Improving performance of git clean”
  1. 0/5 Improving performance of git cleanErik Elfström, Jun 9, 2015
  2. 1/5 setup: add gentle version of read_gitfileErik Elfström, Jun 9, 2015
  3. 2/5 setup: sanity check file size in read_gitfile_gentlyErik Elfström, Jun 9, 2015
  4. Eric SunshineJun 14, 2015
  5. erik elfströmJun 14, 2015
  6. Eric SunshineJun 15, 2015
  7. 3/5 t7300: add tests to document behavior of clean and nested gitErik Elfström, Jun 9, 2015
  8. 4/5 p7300: add performance tests for cleanErik Elfström, Jun 9, 2015
  9. 5/5 clean: improve performance when removing lots of directoriesErik Elfström, Jun 9, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.