[pypy-svn] pypy default: Tweak the number passed to -j to make.

arigo commits-noreply at bitbucket.org
Wed Jan 5 11:25:42 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r40408:20676e2e4dff
Date: 2011-01-05 11:25 +0100
http://bitbucket.org/pypy/pypy/changeset/20676e2e4dff/

Log:	Tweak the number passed to -j to make.

diff --git a/pypy/config/support.py b/pypy/config/support.py
--- a/pypy/config/support.py
+++ b/pypy/config/support.py
@@ -14,8 +14,12 @@
             f = open(filename_or_file, "r")
         else:
             f = filename_or_file
-        return max([int(re.split('processor.*(\d+)', line)[1])
+        count = max([int(re.split('processor.*(\d+)', line)[1])
                     for line in f.readlines()
                     if line.startswith('processor')]) + 1
+        if count >= 4:
+            return max(count // 2, 3)
+        else:
+            return count
     except:
         return 1 # we really don't want to explode here, at worst we have 1

diff --git a/pypy/config/test/test_support.py b/pypy/config/test/test_support.py
--- a/pypy/config/test/test_support.py
+++ b/pypy/config/test/test_support.py
@@ -45,7 +45,7 @@
     saved = os.environ
     try:
         os.environ = FakeEnviron(None)
-        assert detect_number_of_processors(StringIO(cpuinfo)) == 4
+        assert detect_number_of_processors(StringIO(cpuinfo)) == 3
         assert detect_number_of_processors('random crap that does not exist') == 1
         os.environ = FakeEnviron('-j2')
         assert detect_number_of_processors(StringIO(cpuinfo)) == 1


More information about the Pypy-commit mailing list