fix: remove trivial allocations and `try_into`
Use the following array tools to avoid allocations and try_into calls:
-
core::array::from_fn/core::array::try_from_fn -
[T]::first_chunk -
[T]::array_chunks -
[T; N]::map -
iter_fixed::IntoIteratorFixed
Some of the try_into calls are more of a nit just because they look like allocations but are really just slice conversions, but it was easier to just get rid of all of them.
Fair.
I would note though that specialization is probably the least likely feature to be stabilized in the near future, so depending on your plans to remove that from plonky2_field, the introduction of these features may or may not lengthen the timeline to stability (assuming that's your goal).
Other than micro-benchmarks, but there's no real perf impact of this change. I can trim it down to just the stable if there's any interest in that.
I would note though that
specializationis probably the least likely feature to be stabilized in the near future, so depending on your plans to remove that fromplonky2_field, the introduction of these features may or may not lengthen the timeline to stability (assuming that's your goal).
I'd rather avoid adding more unstable features no matter what tbh.
Other than micro-benchmarks, but there's no real perf impact of this change. I can trim it down to just the stable if there's any interest in that.
I'm open to that.
Closing for inactivity.