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

[PATCH v6 5/7] p7300: add performance tests for clean

From
Erik Elfström <erik.elfstrom@gmail.com>
Date
May 10, 2015, 20:00 UTC
Message-ID
<1431288041-21077-6-git-send-email-erik.elfstrom@gmail.com>
In-Reply-To
<1431288041-21077-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.0.60.gf7143f7
Previous: Erik ElfströmNext: Erik Elfström
Message 7 of 9 in “Improving performance of git clean”
  1. 0/7 Improving performance of git cleanErik Elfström, May 10, 2015
  2. 1/7 setup: add gentle version of is_git_directoryErik Elfström, May 10, 2015
  3. 2/7 setup: add gentle version of read_gitfileErik Elfström, May 10, 2015
  4. 3/7 setup: sanity check file size in read_gitfile_gentlyErik Elfström, May 10, 2015
  5. erik elfströmMay 12, 2015
  6. 4/7 t7300: add tests to document behavior of clean and nested gitErik Elfström, May 10, 2015
  7. 5/7 p7300: add performance tests for cleanErik Elfström, May 10, 2015
  8. 6/7 clean: improve performance when removing lots of directoriesErik Elfström, May 10, 2015
  9. 7/7 RFC: Change error handling scheme in read_gitfile_gentlyErik Elfström, May 10, 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.