Skip to content
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

Performance improvements #101

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions boutdata/squashoutput.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ def squashoutput(
from boututils.boutarray import BoutArray
import numpy
import os
import gc
import tempfile
import shutil
import glob
Expand Down Expand Up @@ -238,7 +237,6 @@ def squashoutput(
f.write(varname, var)

var = None
gc.collect()
ZedThree marked this conversation as resolved.
Show resolved Hide resolved

# Copy file attributes
for attrname in outputs.list_file_attributes():
Expand All @@ -252,7 +250,6 @@ def squashoutput(
f.close()

del outputs
gc.collect()

if delete:
if append:
Expand Down
25 changes: 7 additions & 18 deletions boutdata/tests/test_collect.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
# Note - using tmp_path fixture requires pytest>=3.9.0

collect_kwargs_list = [
{"xguards": True, "yguards": "include_upper"},
{"xguards": False, "yguards": False},
]

collect_kwargs_list_full = [
{"xguards": True, "yguards": "include_upper"},
{"xguards": False, "yguards": "include_upper"},
{"xguards": True, "yguards": True},
Expand All @@ -31,10 +36,10 @@
{"xguards": False, "yguards": False},
]


squash_params_list = [
(False, {}),
(True, {}),
(True, {"parallel": 2}),
Copy link
Contributor

Choose a reason for hiding this comment

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

If we change this, are we testing parallelised squashing at all? The parallel version was quite tricky to implement at all, so I'd be very hesitant to remove test coverage. On the other hand, to save time it'd be fine to reduce the number of test cases for it. Maybe just test the parallel version for a single-null and double-null (as the most common/important examples)?

]


Expand Down Expand Up @@ -290,12 +295,8 @@ def test_core_min_files_existing_squash_file_raises(self, tmp_path, time_split):
"time_split",
[
(1, None),
(2, None),
(2, 3),
(3, None),
(4, None),
(5, None),
(6, None),
(7, None),
],
)
Expand Down Expand Up @@ -874,11 +875,6 @@ def test_singlenull(self, tmp_path, squash_params, collect_kwargs):
# {"parallel": False},
{"parallel": 1},
{"parallel": 2},
{"parallel": 3},
{"parallel": 4},
{"parallel": 5},
{"parallel": 6},
{"parallel": 7},
{"parallel": 8},
{"parallel": True},
),
Expand Down Expand Up @@ -1396,7 +1392,7 @@ def test_singlenull_tind_xind_yind_zind(
)

@pytest.mark.parametrize("squash_params", squash_params_list)
@pytest.mark.parametrize("collect_kwargs", collect_kwargs_list)
@pytest.mark.parametrize("collect_kwargs", collect_kwargs_list_full)
def test_connected_doublenull_min_files(
self, tmp_path, squash_params, collect_kwargs
):
Expand Down Expand Up @@ -1736,13 +1732,6 @@ def test_disconnected_doublenull(
[
{},
{"compress": True, "complevel": 1},
{"compress": True, "complevel": 2},
{"compress": True, "complevel": 3},
{"compress": True, "complevel": 4},
{"compress": True, "complevel": 5},
{"compress": True, "complevel": 5},
{"compress": True, "complevel": 7},
{"compress": True, "complevel": 8},
{"compress": True, "complevel": 9},
],
)
Expand Down
4 changes: 0 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ dynamic = ["version"]
[project.optional-dependencies]
tests = [
"pytest",
"pytest-cov",
]
docs = [
"sphinx>=3.4,<5",
Expand All @@ -60,6 +59,3 @@ version = { attr = "setuptools_scm.get_version" }

[tool.setuptools_scm]
write_to = "boutdata/_version.py"

[tool.pytest.ini_options]
addopts = "--cov=boutdata"
Loading