From acdd0e3ffff0db9f45951c6b51887937ca31935e Mon Sep 17 00:00:00 2001 From: Pieter Eendebak Date: Tue, 23 Aug 2022 08:55:56 +0200 Subject: PERF: Eliminate slow check for pypy during numpy import (#22163) This PR replaces the import of platform and a call to platform.python_implementation() with a check using sys.implementation.name to improve the numpy import time. The improvement is about 5-10 ms (system dependent). Also see #22061 Co-authored-by: Matti Picus --- numpy/testing/_private/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numpy/testing/_private/utils.py') diff --git a/numpy/testing/_private/utils.py b/numpy/testing/_private/utils.py index c553658cb..26b2aac4d 100644 --- a/numpy/testing/_private/utils.py +++ b/numpy/testing/_private/utils.py @@ -48,7 +48,7 @@ class KnownFailureException(Exception): KnownFailureTest = KnownFailureException # backwards compat verbose = 0 -IS_PYPY = platform.python_implementation() == 'PyPy' +IS_PYPY = sys.implementation.name == 'pypy' IS_PYSTON = hasattr(sys, "pyston_version_info") HAS_REFCOUNT = getattr(sys, 'getrefcount', None) is not None and not IS_PYSTON HAS_LAPACK64 = numpy.linalg.lapack_lite._ilp64 -- cgit v1.2.1