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
22 changes: 22 additions & 0 deletions asv_bench/benchmarks/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""
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.run(cmd, stderr=subprocess.PIPE)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a comment for this as 3.7 actually does the timing, where for < 3.7 asv is doing the timing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment added + green


line = p.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.run(cmd, stderr=subprocess.PIPE)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a lint error to assign to p?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think it should be, no idea why it isn't. will fix anyway

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