scipp / scipp/scipp

Optimise: Do not copy in `values`

Open
#3,962 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
146
Forks
23
Avg merge
2d 7h
Merged PRs (30d)
7

Description

Based on

The second column then copies the whole event table to strip variances that were never attached. So the present cost is not the price of uncertainties, it is the price of failing to attach them.

from scipp/ess#677.

I am surprised that sc.values(x) makes a copy at all. I would have expected it to return a view of the values. And maybe the same for sc.variances, though that could be trickier. But are implemented in terms of transform. Can we change this to work more like the .fields accessors?

Failing that, we should at least avoid the copy in sc.values if the input has no variances. In this case, the function could return a shallow copy.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the implementations of sc.values and sc.variances, especially their use of transform, and compare them with the .fields accessors. Determine the intended view or shallow-copy behavior, including the no-variances case. Done means the unnecessary values copy is avoided and the resulting accessor behavior is covered by the relevant existing checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
data
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.