On Friday, 4 March 2016 at 16:45:42 UTC, Andrei Alexandrescu wrote:
Currently we have a very useful stride() function that allows spanning a random access range with a specified step, e.g. 0, 3, 6, 9, ... for step 3.

I've run some measurements recently and it turns out a compile-time-known stride is a lot faster than a variable. So I was thinking to improve Stride(R) to take an additional parameter: Stride(R, size_t step = 0). If step is 0, then use a runtime-valued stride as until now. If nonzero, Stride should use that compile-time step.

Takers?

This makes me wonder if something like iota would benefit from a similar optimization. It's frequently the case that all of the arguments to iota are known at compile time. Now, iota isn't wrapping another range (unlike stride), so maybe that would make the difference, and iota wouldn't particularly benefit from having its arguments be template arguments, but I have to wonder.

- Jonathan M Davis

Reply via email to