From 64461d2051f2c0f617b2ffe933976be5c43cbeae Mon Sep 17 00:00:00 2001 From: Michael Niklas Date: Mon, 17 Oct 2022 10:10:48 +0200 Subject: [PATCH 1/3] add import asv benchmark --- asv_bench/benchmarks/import.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 asv_bench/benchmarks/import.py diff --git a/asv_bench/benchmarks/import.py b/asv_bench/benchmarks/import.py new file mode 100644 index 00000000000..23b139b0db4 --- /dev/null +++ b/asv_bench/benchmarks/import.py @@ -0,0 +1,12 @@ +class Import: + """Benchmark importing xarray""" + + def timeraw_import_xarray(): + return """ + import xarray + """ + + def timeraw_import_xarray_plot(): + return """ + import xarray.plot as xplt + """ From d9e7b7367de41be9238cb2b3823f016d569398e9 Mon Sep 17 00:00:00 2001 From: Michael Niklas Date: Mon, 17 Oct 2022 10:15:59 +0200 Subject: [PATCH 2/3] add backends import timing --- asv_bench/benchmarks/import.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/asv_bench/benchmarks/import.py b/asv_bench/benchmarks/import.py index 23b139b0db4..a7801fb42cf 100644 --- a/asv_bench/benchmarks/import.py +++ b/asv_bench/benchmarks/import.py @@ -8,5 +8,11 @@ def timeraw_import_xarray(): def timeraw_import_xarray_plot(): return """ - import xarray.plot as xplt + import xarray.plot + """ + + def timeraw_import_xarray_backends(): + return """ + from xarray.backends import list_engines + list_engines() """ From 24ba96cc3e34410c8b1bfeeb66b15735753b693d Mon Sep 17 00:00:00 2001 From: Michael Niklas Date: Mon, 17 Oct 2022 10:42:29 +0200 Subject: [PATCH 3/3] fix forgotten self arg --- asv_bench/benchmarks/import.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/asv_bench/benchmarks/import.py b/asv_bench/benchmarks/import.py index a7801fb42cf..4d326d41d75 100644 --- a/asv_bench/benchmarks/import.py +++ b/asv_bench/benchmarks/import.py @@ -1,17 +1,17 @@ class Import: """Benchmark importing xarray""" - def timeraw_import_xarray(): + def timeraw_import_xarray(self): return """ import xarray """ - def timeraw_import_xarray_plot(): + def timeraw_import_xarray_plot(self): return """ import xarray.plot """ - def timeraw_import_xarray_backends(): + def timeraw_import_xarray_backends(self): return """ from xarray.backends import list_engines list_engines()