This is fun and all, but the benchmarks here aren't really what the author seems to think they are. This isn't "computationally expensive", the script is basically only control flow, where the CPU spend more time doing variable lookups than the actual computation. This means most of the pipeline width sits completely unused, whcih is a pretty large disservice to the M1 and the i5.
There's also no control for the thermal throttling of the M1, which is probably why the 100,000 example is performing worse.
There's also no control for the thermal throttling of the M1, which is probably why the 100,000 example is performing worse.