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

Enforce stricter recyling rules #201

Merged
merged 13 commits into from
Oct 16, 2024
Merged

Conversation

sebffischer
Copy link
Collaborator

@sebffischer sebffischer commented Oct 12, 2024

  1. When assigning to a vector like l[s] = r we need to perform the length check before starting the assignment in case we directly mutate l, as we might otherwise get a corrupted left hand side.. This length check is possibly expensive.
    if the left hand side is cloned anyway (in case there is more than one reference to the internal vector data) we could just start clone the data and overwrite it. When we then afterwards figure out that the lhs and rhs iterator were not recyclable the result can just be discarded. For now I have just implemented a relatively naive solution.
  2. When conducting vectorized operations such as +, we can alyways just start the computation. It one if the iterators is not yet exhausted after iterating, we can then throw an error and discard the result.

TODOs:

  • for scenario (2): Handle the case where either the lhs or rhs iterator has length 1.
  • Ensure that the issues / suggestions listed here: Stricter recycling rules #98 are all covered
  • Integrate the relevant tests from here: Feat/coerce #155
  • unify the rep.rs recycling tests with the reptype.rs recycling tests

@sebffischer sebffischer merged commit e3e874c into dgkf:main Oct 16, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant