Adds `iterator_diff_` and `iterator_intersect_` functions
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:
- [x] Clean up code
- [x] Add argument checks and exceptions
- [x] Add tests for checks and exceptions
- [x] Test for Iterators directly
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.