Skip to content

render: avoid deepcopying #9033

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 2 commits into from
Feb 15, 2023
Merged
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
4 changes: 1 addition & 3 deletions dvc/render/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ def _group_by_rev(datapoints):


def to_json(renderer, split: bool = False) -> List[Dict]:
from copy import deepcopy

if renderer.TYPE == "vega":
grouped = _group_by_rev(deepcopy(renderer.datapoints))
grouped = _group_by_rev(renderer.datapoints)
if split:
content = renderer.get_filled_template(skip_anchors=["data"])
else:
Expand Down
3 changes: 1 addition & 2 deletions dvc/render/converter/vega.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from copy import deepcopy
from typing import Any, Dict, Iterable, List, Optional, Tuple, Union

from funcy import first, last
Expand Down Expand Up @@ -233,7 +232,7 @@ def flat_datapoints(self, revision): # noqa: C901
for i, (y_file, y_field) in enumerate(ys):
if num_xs > 1:
x_file, x_field = xs[i]
datapoints = deepcopy(file2datapoints.get(y_file, []))
datapoints = [d.copy() for d in file2datapoints.get(y_file, [])]

if props_update.get("y", None) == "dvc_inferred_y_value":
_update_from_field(
Expand Down