Open Osveron opened 6 years ago
I like the way the API is at the moment; having Iterator
be over full vectors only gives people a way to opt out of our partial vector handling. The lack of in-place mutation may be unintuitive at first, but I think storing the vector on every iteration wouldn't be the right way forward, as simd_for_each
lets one do in-place mapping easily.
If someone wants to opt-out of partial vector handling than, I think it would be better to have something like simd_even_iter
, that would be more obvious for someone who just reads the code what the intention was. Not storing on every iteration is exactly what simd_do_each
does, any you can store manually from there, if you need to.
Current API is not bad, but it has some problems. Because this crate implements standard
Iterator
trait simd iterators can be used in for loops(and they are currently used for example in benchmarks), but inside those loops there is no uneven collection handling, this I think can be added, but it would reduce performance. Second thing is that inside for loops there is no in place mutation, you need to manually store. I think it would be better to just have internal iterator trait, and implement functionality on top of it, it would also allow dropping simd prefix on iterators methods. It would make the API more similar to the standard library, with exception of providing defaults. Thoughts?