Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(670)

Unified Diff: gclient_utils.py

Issue 202753003: Rationalize the git config settings for index-pack performance. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: comment Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gclient_scm.py ('k') | git_cache.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient_utils.py
diff --git a/gclient_utils.py b/gclient_utils.py
index 1801a6b5723e80cb12dd9f609d727e5c13faf647..7003fc88676b49e79aba8acbd5f68bdd2cdb7fd3 100644
--- a/gclient_utils.py
+++ b/gclient_utils.py
@@ -9,6 +9,7 @@ import cStringIO
import logging
import os
import pipes
+import platform
import Queue
import re
import stat
@@ -960,3 +961,23 @@ def NumLocalCpus():
# Mac OS 10.6 only
# pylint: disable=E1101
return int(os.sysconf('SC_NPROCESSORS_ONLN'))
+
+def DefaultDeltaBaseCacheLimit():
+ """Return a reasonable default for the git config core.deltaBaseCacheLimit.
+
+ The primary constraint is the address space of virtual memory. The cache
+ size limit is per-thread, and 32-bit systems can hit OOM errors if this
+ parameter is set too high.
+ """
+ if platform.architecture()[0].startswith('64'):
+ return '2g'
+ else:
+ return '512m'
iannucci 2014/03/18 20:24:27 for future: I'd really like if we could do this on
+
+def DefaultIndexPackConfig():
+ """Return reasonable default values for configuring git-index-pack.
+
+ Experiments suggest that higher values for pack.threads don't improve
+ performance."""
+ return ['-c', 'pack.threads=5', '-c',
+ 'core.deltaBaseCacheLimit=%s' % DefaultDeltaBaseCacheLimit()]
« no previous file with comments | « gclient_scm.py ('k') | git_cache.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698