1. 24
  1. 4

    Wow, I didn’t realize Python was that much slower than C even when literally doing nothing!

    1. 1

      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…

    2. 3

      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.

      1. 3

        Maybe the options would be more clear if they were 1-99, 10-999, etc.

        1. 7

          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.

      2. 3

        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.

        1. 1

          This is very interesting and all, but don’t try to guess where the bottleneck is. Always benchmark.

          Stories with similar links:

          1. One second code: Do YOU know how much your computer can do in a second? via av 5 years ago | 13 points | 3 comments