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

Avoid copying binned coords in operations? #3334

Open
SimonHeybrock opened this issue Nov 28, 2023 · 0 comments
Open

Avoid copying binned coords in operations? #3334

SimonHeybrock opened this issue Nov 28, 2023 · 0 comments

Comments

@SimonHeybrock
Copy link
Member

Currently Scipp always makes a copy of binned coords (everything in var.bins.coords) during operations. This cannot be avoided in all cases, namely when the bin-indices are non-regular. This happens, e.g., when operating on a slice or a transpose.

However, in practice indices are regular in most cases. We could thus avoid the copy.

Advantages:

  • Better performance.
  • Less memory use.
  • More consistent with "normal" coords, which are always shared.

Disadvantages:

  • Inconsistent and potentially surprising behavior when working with slices (or other non-regular indices).

In practice the performance improvement and memory reduction can be quiet significant, in common cases we might expect a 2x memory reduction and 2x performance improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant