On 09/02/2017 10:46 AM, Michał Górny wrote:
> dev-python/pycparser-2.18+ exposes a design flaw in dev-python/ply that
> makes it unable to work with -OO code. Remove the optimizations from
> Portage shebangs to prevent triggering the issue until we find a proper
> solution for it.
> 
> Bug: https://bugs.gentoo.org/628386
> ---
>  bin/clean_locks   | 2 +-
>  bin/dispatch-conf | 2 +-
>  bin/ebuild        | 2 +-
>  bin/emaint        | 2 +-
>  bin/env-update    | 2 +-
>  bin/portageq      | 2 +-
>  tabcheck.py       | 2 +-
>  7 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/bin/clean_locks b/bin/clean_locks
> index 13af06197..fb245972f 100755
> --- a/bin/clean_locks
> +++ b/bin/clean_locks
> @@ -1,4 +1,4 @@
> -#!/usr/bin/python -bO
> +#!/usr/bin/python -b

The diff shows -O, but the commit messages says -OO, so which one is it really?

Are we sure that it's worth it to load all of the __doc__ strings into
memory, given that we have alternative implementations for everything
that pycrypto provides?

For the record, I measure an increase of from 30248K to 31504K for -OO vs 
without when
importing all portage modules, tested as follows:

$ python3.6 -OO pym/portage/tests/runTests.py 
pym/portage/tests/lint/test_import_modules.py
testImportModules 
(portage.tests.lint.test_import_modules.ImportModulesTestCase) ... 30248

$ python3.6 -O pym/portage/tests/runTests.py 
pym/portage/tests/lint/test_import_modules.py
testImportModules 
(portage.tests.lint.test_import_modules.ImportModulesTestCase) ... 31468

$ python3.6  pym/portage/tests/runTests.py 
pym/portage/tests/lint/test_import_modules.py
testImportModules 
(portage.tests.lint.test_import_modules.ImportModulesTestCase) ... 31504

Using this patch:

diff --git a/pym/portage/tests/lint/test_import_modules.py 
b/pym/portage/tests/lint/test_import_modules.py
index fcdcb3b33..6350197eb 100644
--- a/pym/portage/tests/lint/test_import_modules.py
+++ b/pym/portage/tests/lint/test_import_modules.py
@@ -2,6 +2,7 @@
 # Distributed under the terms of the GNU General Public License v2
 
 from itertools import chain
+import resource
 
 from portage.const import PORTAGE_PYM_PATH, PORTAGE_PYM_PACKAGES
 from portage.tests import TestCase
@@ -24,6 +25,7 @@ class ImportModulesTestCase(TestCase):
                                if mod not in expected_failures:
                                        self.assertTrue(False, "failed to 
import '%s': %s" % (mod, e))
                                del e
+               print(resource.getrusage(resource.RUSAGE_SELF).ru_maxrss)
 
        def _iter_modules(self, base_dir):
                for parent, dirs, files in os.walk(base_dir):

-- 
Thanks,
Zac

Reply via email to