summaryrefslogtreecommitdiffstats
path: root/tests/test_subcmds_sync.py
diff options
context:
space:
mode:
authorJosip Sokcevic <sokcevic@chromium.org>2024-10-07 17:33:38 +0000
committerLUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com>2024-10-07 18:44:19 +0000
commit454fdaf1191c87e5c770ab865a911e10e600e178 (patch)
treea20af3e4f05b48f28d30346648ab9fa1be7f4f64 /tests/test_subcmds_sync.py
parentf7f9dd4deb3b92bf175a0411dac60e7b6fdd9cfa (diff)
downloadgit-repo-454fdaf1191c87e5c770ab865a911e10e600e178.tar.gz
sync: Always use WORKER_BATCH_SIZEv2.48
With 551285fa35ccd0836513e9cf64ee8d3372e5e3f4, the comment about number of workers no longer stands - dict is shared among multiprocesses and real time information is available. Using 2.7k projects as the baseline, using chunk size of 4 takes close to 5 minutes. A chunk size of 32 takes this down to 40s - a reduction of rougly 8 times which matches the increase. R=gavinmak@google.com Bug: b/371638995 Change-Id: Ida5fd8f7abc44b3b82c02aa0f7f7ae01dff5eb07 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/438523 Commit-Queue: Josip Sokcevic <sokcevic@google.com> Tested-by: Josip Sokcevic <sokcevic@google.com> Reviewed-by: Gavin Mak <gavinmak@google.com>
Diffstat (limited to 'tests/test_subcmds_sync.py')
-rw-r--r--tests/test_subcmds_sync.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_subcmds_sync.py b/tests/test_subcmds_sync.py
index 8dde687c..b871317c 100644
--- a/tests/test_subcmds_sync.py
+++ b/tests/test_subcmds_sync.py
@@ -355,6 +355,30 @@ class SafeCheckoutOrder(unittest.TestCase):
355 ) 355 )
356 356
357 357
358class Chunksize(unittest.TestCase):
359 """Tests for _chunksize."""
360
361 def test_single_project(self):
362 """Single project."""
363 self.assertEqual(sync._chunksize(1, 1), 1)
364
365 def test_low_project_count(self):
366 """Multiple projects, low number of projects to sync."""
367 self.assertEqual(sync._chunksize(10, 1), 10)
368 self.assertEqual(sync._chunksize(10, 2), 5)
369 self.assertEqual(sync._chunksize(10, 4), 2)
370 self.assertEqual(sync._chunksize(10, 8), 1)
371 self.assertEqual(sync._chunksize(10, 16), 1)
372
373 def test_high_project_count(self):
374 """Multiple projects, high number of projects to sync."""
375 self.assertEqual(sync._chunksize(2800, 1), 32)
376 self.assertEqual(sync._chunksize(2800, 16), 32)
377 self.assertEqual(sync._chunksize(2800, 32), 32)
378 self.assertEqual(sync._chunksize(2800, 64), 32)
379 self.assertEqual(sync._chunksize(2800, 128), 21)
380
381
358class GetPreciousObjectsState(unittest.TestCase): 382class GetPreciousObjectsState(unittest.TestCase):
359 """Tests for _GetPreciousObjectsState.""" 383 """Tests for _GetPreciousObjectsState."""
360 384