Skip to main content

Timeline for answer to How to extract N elements every M elements from an array? by U13-Forward

Current License: CC BY-SA 4.0

Post Revisions

15 events
when toggle format what by license comment
Jun 14, 2024 at 10:42 comment added U13-Forward @mozway I tested with 499875840 elements, as the op specified.
Jun 14, 2024 at 10:39 history edited U13-Forward CC BY-SA 4.0
edited body
Jun 14, 2024 at 10:26 comment added mozway OK, so it's more or less back to hpaulj's 3D reshaping (which was also my original approach when the question was not yet clarified) ;) Note that your current updated #1 gives 2D arrays, you need an extra step to get 1D. Also, the repeated slicing starts to be expensive when M is large
Jun 14, 2024 at 10:21 comment added U13-Forward @mozway Check my newest edit!
Jun 14, 2024 at 10:21 history edited U13-Forward CC BY-SA 4.0
added 1099 characters in body
Jun 14, 2024 at 10:14 history edited U13-Forward CC BY-SA 4.0
added 1099 characters in body
Jun 14, 2024 at 7:13 comment added mozway Also, generalizing to M output arrays (as indicated by OP, M = 3 in their current case), the "fastest" approach would require "M" slicing steps, this is not taken into account in these timings.
Jun 14, 2024 at 6:54 comment added mozway Timing on 16 items is most likely not meaningful. If it was, then a better option would be a fixed size indexing. As you can see in my original timings, the fastest approaches for small arrays scale badly. You should time using a wide range of sizes
Jun 13, 2024 at 22:19 history edited U13-Forward CC BY-SA 4.0
added 2814 characters in body
Jun 13, 2024 at 21:55 history edited U13-Forward CC BY-SA 4.0
added 1339 characters in body
Jun 13, 2024 at 21:49 history edited U13-Forward CC BY-SA 4.0
added 1339 characters in body
Jun 10, 2024 at 17:46 history edited U13-Forward CC BY-SA 4.0
added 192 characters in body
Jun 10, 2024 at 17:37 history edited U13-Forward CC BY-SA 4.0
added 287 characters in body
Jun 10, 2024 at 17:27 history edited U13-Forward CC BY-SA 4.0
added 177 characters in body
Jun 10, 2024 at 17:15 history answered U13-Forward CC BY-SA 4.0