Skip to content

PERF: asv for import #28239

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Sep 5, 2019
24 changes: 24 additions & 0 deletions asv_bench/benchmarks/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""
Benchmarks for pandas at the package-level.
"""
import subprocess
import sys

from pandas.compat import PY37


class TimeImport:
def time_import(self):
if PY37:
cmd = [sys.executable, "-X", "importtime", "-c", "import pandas as pd"]
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
_, stderr = p.communicate()

line = stderr.splitlines()[-1]
field = line.split(b"|")[-2].strip()
total = int(field) # microseconds
return total

cmd = [sys.executable, "-c", "import pandas as pd"]
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p.communicate()
2 changes: 1 addition & 1 deletion pandas/core/dtypes/dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
ordered_sentinel = object() # type: object


def register_extension_dtype(cls: Type[ExtensionDtype],) -> Type[ExtensionDtype]:
def register_extension_dtype(cls: Type[ExtensionDtype]) -> Type[ExtensionDtype]:
"""
Register an ExtensionType with pandas as class decorator.

Expand Down
2 changes: 1 addition & 1 deletion pandas/util/_test_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def _skip_if_no_scipy():
)


def skip_if_installed(package: str,) -> Callable:
def skip_if_installed(package: str) -> Callable:
"""
Skip a test if a package is installed.

Expand Down