Wow, I didn’t realize Python was that much slower than C even when literally doing nothing!
Of course, a sufficiently smart VM (with a jit, perhaps, and optimizations) will be closer to C, but VMs have a lot of instruction overhead. Unpack the instructions, dispatch the instructions, copy data into registers (or the stack in Python’s case) to carry out the instructions…
Kind of weird to get flagged as wrong when you guess on the order of 1e6, the exact answer is 1.1e7, and 1e8 would be accepted.
Maybe the options would be more clear if they were 1-99, 10-999, etc.
Oh, it’s not that it’s unclear, it’s just that intuitively I think of 1 million as a better answer than 100 million when the actual number is 11 million.
I enjoyed the presentation of this, even if there are some small problems as suggested. All this stuff would be great to run and verify on your own to internalize as well.
This is very interesting and all, but don’t try to guess where the bottleneck is. Always benchmark.