Skip to content

Commit

Permalink
render: avoid deepcopying (iterative#9033)
Browse files Browse the repository at this point in the history
* render: avoid deepcopying

* remove unnecessary line
  • Loading branch information
skshetry authored Feb 15, 2023
1 parent cbe46cc commit be824ed
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
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

0 comments on commit be824ed

Please sign in to comment.