News for hackers. Stuff that matters.
Re:Python 3.11 beta vs. 3.10 benchmark by Aardwolf on Wednesday May 18, 2022 @04:59PM (#31427575)
> The explanation is that Python features heavy dynamism

JavaScript too, any function can be dynamically changed at any time, but its function calls are 30x faster (roughly, I measured it just now with a for loop doing 100 million function calls, which took 0.5s in JS, 15s in python)

This is a realistic scenario if you want to run e.g. a custom statistics function on a large array in python so it can be annoying (and yes numpy can do things but that's no reason to keep the main language encouraging less readable code where you don't define separate functions)

Re:Python 3.11 beta vs. 3.10 benchmark by ptx on Wednesday May 18, 2022 @06:37PM (#31428514)
> its function calls are 30x faster (roughly, I measured it just now with a for loop doing 100 million function calls, which took 0.5s in JS, 15s in python)

Your benchmark also measures iterators and boxed integers, which were not in the JavaScript version, so it's not clear how much of the difference is due to function call overhead.

(Of course, it certainly doesn't help Python's performance that there's no simple way to do loops without iterators and integers without boxing. It would be nice if a future version could optimize the abstractions away.)

Re:Python 3.11 beta vs. 3.10 benchmark by SemanticStrengh on Thursday May 19, 2022 @05:27AM (#31432433)
JS integers are value types unlike Java?!
Re:Python 3.11 beta vs. 3.10 benchmark by ptx on Thursday May 19, 2022 @07:00AM (#31432927)
On second thought, I'm not sure. Can you observe the number's object identity like you can in Python? Does JavaScript have to allocate a new Number object for each "i++"?

My point was that the Python version of Aardwolf's function call benchmark [1] is definitely using iterators and boxing all numbers, so it's doing a lot more than just calling a function, and the Java equivalent would look something like this:

    Long f(Integer x) {
        return new Long(x.longValue() * x.longValue());
    }

    // ...

    Double v = new Double(0.0);

    Iterator<Integer> range = IntStream.range(0, 100000000).iterator();
    while (range.hasNext()) {
        Integer i = range.next();
        v = new Double(v.doubleValue() + f(i).doubleValue());
    }
[1] https://news.ycombinator.com/item?id=31427506
Re:Python 3.11 beta vs. 3.10 benchmark by BiteCode_dev on Wednesday May 18, 2022 @05:25PM (#31427879)
Hence the "So it's something that had be delayed.", and not "this is something impossible".

Javascript has the benefit of having billions of dollars allocated to it from Google/Microsoft/Apple to hire dozen of amazing engineers full time over decades to work on it.

Python has existed since 1994, yet in 2011, the Python Software Fundation budget was less than $40K: https://pyfound.blogspot.com/2012/01/psf-grants-over-37000-t...

We are talking a difference of funding of 6 order of magnitudes. Not to mention one is a language that has to stand on its own, the second has an accidental monopoly on the most popular plateform in the world.

So it had to be delayed, unlike for JS.

Re:Python 3.11 beta vs. 3.10 benchmark by SemanticStrengh on Wednesday May 18, 2022 @06:01PM (#31428172)
> Python has existed since 1994, yet in 2011, the Python Software Fundation budget was less than $40K Exact, as usual it is mainly a question of human resources. Hence why I advocate for Python switching to GraalPython as the default runtime, it would enable much better performance in the next few years.

Also, I'm pretty sure cpython devs should ask Google/OpenAI/MicrosoftAI funding, how many millions can they waste on useless projects while not improving the core bottleneck..

Re:Python 3.11 beta vs. 3.10 benchmark by BiteCode_dev on Thursday May 19, 2022 @01:32AM (#31431119)
You are asking for the rarest thing of all, a geek and volounteer worker that is also good at dealing with big entities and comfortable with managing money.