News for hackers. Stuff that matters.
Re:Mugo, a toy compiler for a subset of Go that can compile ... by nonameiguess on Tuesday April 13, 2021 @07:59AM (#26791018)
Note that Python tends to get around this by providing a wide variety of fast builtin functions to do stuff that would otherwise be slow.

    $ time python -c 'sum = 0
    > for i in range(1000000000): sum += 1'

    real 0m56.655s
    user 0m56.646s
    sys  0m0.008s
Compare to:

    time python -c 'sum(range(1000000000))'

    real 0m8.693s
    user 0m8.684s
    sys  0m0.008s
In reality, anyone is going to do heavy arithmetic using Numpy anyway:

    $ time python -c 'import numpy as np; np.sum(np.arange(1000000000))'

    real 0m2.022s
    user 0m1.661s
    sys  0m2.061s
As a nice bonus, you get hardware speed but it still gives you the right answer, unlike Node trying to use limited precision primitive types.

There are no comments on this comment yet.