Skip to content

Comments

Adds iterator_diff_ and iterator_intersect_ functions#2

Draft
doekenorg wants to merge 14 commits intomainfrom
diff_intersect
Draft

Adds iterator_diff_ and iterator_intersect_ functions#2
doekenorg wants to merge 14 commits intomainfrom
diff_intersect

Conversation

@doekenorg
Copy link
Owner

@doekenorg doekenorg commented Aug 14, 2021

Unlike stated in the README it can be possible to implement _diff and _intersect functions by repeatedly looping of the provided iterators. Because this is probably not the most performant check, for now this PR is mostly an experiment. It remains to be seen if it will be released.

This PR tries to implement the following functions:

  • iterator_diff
  • iterator_diff_assoc
  • iterator_diff_key
  • iterator_diff_uassoc
  • iterator_diff_ukey
  • iterator_udiff
  • iterator_udiff_assoc
  • iterator_udiff_uassoc
  • iterator_intersect
  • iterator_intersect_assoc
  • iterator_intersect_key
  • iterator_intersect_uassoc
  • iterator_intersect_ukey
  • iterator_uintersect
  • iterator_uintersect_assoc
  • iterator_uintersect_uassoc

Todo:

  • Clean up code
  • Add argument checks and exceptions
  • Add tests for checks and exceptions
  • Test for Iterators directly

@doekenorg doekenorg changed the title Adds iterator_diff_ and iterator_intersect_ functions WIP: Adds iterator_diff_ and iterator_intersect_ functions Aug 14, 2021
@doekenorg doekenorg marked this pull request as draft August 14, 2021 18:51
@doekenorg doekenorg changed the title WIP: Adds iterator_diff_ and iterator_intersect_ functions Adds iterator_diff_ and iterator_intersect_ functions Aug 14, 2021
@doekenorg doekenorg added this to the 1.1.0 milestone Aug 16, 2021
@doekenorg
Copy link
Owner Author

Added 2 benchmark tests. It proves that iterator_map indeed uses way less memory, so Yay for that. But it also shows that the iterator_dif() function, and therefore every other _diff or _intersect function is way way way way way slower. Not sure what to do. Should I release and make a note of the inherent slowness, or just not release it? 🤷

There might be a way to speed things up a bit, but that would require an array hash-map, which will negate the memory benefits. So the only added value is you: can directly reference an iterator without the use of iterator_to_array(). I don't see that as a big win.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant