News for hackers. Stuff that matters.
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by divbzero on Sunday September 27, 2020 @03:18AM (#24604871)
Love seeing the triple release. PyPy has come a long way on Python 3 since Py3k [1] and Fulcrum [2] and great to see a non-EOL Python 2 out in the wild.

[1]: https://morepypy.blogspot.com/2012/01/py3k-and-numpy-first-s...

[2]: https://morepypy.blogspot.com/2014/06/pypy3-231-fulcrum.html

Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by benatkin on Sunday September 27, 2020 @02:44AM (#24604717)
Long live Python2 :)

    docker run pypy:2.7-7.3.2 python -c "print 'no quotes, integer division %s / %s => %s' % (5, 3, 5 / 3)"
    no quotes, integer division 5 / 3 => 1
Edit: i mean no parenthesis
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by kzrdude on Sunday September 27, 2020 @03:15AM (#24604862)
Why do they hang on to Python2.7? I suppose it doesn't have so much maintenance cost for them.

I have to say that their official benchmarks point out a performance comparison to python 2.7, and at this time that sounds irrelevant - comparison to Python 3 would be relevant.

Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by progval on Sunday September 27, 2020 @05:00AM (#24605236)
> Why do they hang on to Python2.7?

https://doc.pypy.org/en/latest/faq.html#how-long-will-pypy-s...

PyPy is written in RPython, which is a subset of Python 2 without most of the dynamic features, so it can be compiled. Moving it to a subset of Python 3 would be a major effort, as they would have to rewrite both the PyPy code and the RPython compiler.

And RPython, being a subset of Python, can also be interpreted, so they probably want to keep the Python 2 interpreter so they can interpret it.

Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by d0mine on Sunday September 27, 2020 @07:08AM (#24605776)
Given how limited RPython is, are you sure RPython is not Python 2/3 compatible as is? What Python 2 only features it uses?

The faq that you've linked says that RPython will continue to run on Python 2 as long as Pypy exists, it says nothing about running RPython on Python 3 interpreter.

Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by kzrdude on Sunday September 27, 2020 @05:40AM (#24605429)
Thanks, that's understandable.

I think that they should switch to displaying and talking about Py 3 comparison benchmarks to give the impression that they are a non-legacy project.

Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by neolog on Sunday September 27, 2020 @03:29AM (#24604911)
The main reason to move to py3 is the libraries, but they're not using any libraries.
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by kzrdude on Sunday September 27, 2020 @04:36AM (#24605147)
It must rather be about what their users need - their users use libraries for sure. But maybe their users are still on Py 2.7.
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by raverbashing on Sunday September 27, 2020 @03:35AM (#24604935)
Cool now do UnicodeDecodeError :)
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by baq on Sunday September 27, 2020 @03:49AM (#24604992)
And print a traceback of a re-raised exception :)
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by tarasglek on Sunday September 27, 2020 @02:48AM (#24604732)
PyPy is awesome. I wrote some scapy packet-processing code, got a 10x speedup from PyPy
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by vkaku on Sunday September 27, 2020 @03:51AM (#24605001)
+1 scapy really helped me before and I'm glad pypy is making packet dumps better
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by bionhoward on Sunday September 27, 2020 @11:04AM (#24607143)
To predict COVID treatment side effects, we built a whole-transcriptome Trie with Scylla and PyPy and it sped up a bajillion times over raw python. Good times
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by optimalsolver on Sunday September 27, 2020 @11:12AM (#24607208)
Did you benchmark PyPy against numba?
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by yjftsjthsd-h on Sunday September 27, 2020 @11:44AM (#24607476)
Doesn't numpy require changing the code? When it works, my understanding is that pypy is a drop-in replacement.
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by devxpy on Sunday September 27, 2020 @12:09PM (#24607696)
OP said "numba", not "numpy" - numba is a JIT that's compatible with CPython!

https://numba.pydata.org/

Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by yjftsjthsd-h on Sunday September 27, 2020 @12:52PM (#24608017)
Ah, I'd assumed a typo; thanks! However, I can't tell if/how much my concerns hold:

> You don't need to replace the Python interpreter, run a separate compilation step, or even have a C/C++ compiler installed. Just apply one of the Numba decorators to your Python function, and Numba does the rest.

(Emphasis mine)

Also, I can't tell whether https://numba.readthedocs.io/en/stable/user/5minguide.html#w... implies that some code won't work, or won't get faster?

Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by devxpy on Sunday September 27, 2020 @03:28PM (#24609462)
Yes, some code won't work -- numba has a nice compiler that will show you errors if it cannot infer the type of even a single variable at compile time (which usually happens the first time you call your function at run-time).

The argument of "some code won't get faster" is null, since you typically only want to use `@njit`, which ensures that you're in `nopython` mode.

I guess that's a double edged sword, in that when it says `nopython`, it really does mean no python.

This means you can only use features from the python interpreter that the numba team has re-implemented in LLVM IR.

---

IIRC `@njit` does involve an overhead in `lowering` the types from python -> LLVM when the first njit function in the call graph is invoked, but not after that.

All this means that if you use `for-loops` in nopython mode, they are guaranteed to run faster, at least in my experience.

Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by nurettin on Sunday September 27, 2020 @11:49AM (#24607520)
It is, I ran python-neat with it. Almost doubled the speed.
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by optimalsolver on Sunday September 27, 2020 @12:23PM (#24607799)
Who said anything about numpy?
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by yjftsjthsd-h on Sunday September 27, 2020 @12:52PM (#24608022)
Ah, I'd assumed that was a typo
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by pjmlp on Sunday September 27, 2020 @04:06AM (#24605046)
Great progress, one day this will be the main reference implementation.
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by aitchnyu on Sunday September 27, 2020 @04:52PM (#24610047)
Is there an up to date comparison of PyPy and CPython with areas where the former must catch up?
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by pjmlp on Monday September 28, 2020 @03:47AM (#24614070)
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by gjvc on Sunday September 27, 2020 @05:26PM (#24610253)
coming from you, I might just have faith that it might :-)
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by visarga on Sunday September 27, 2020 @02:45AM (#24604723)
Is it still true that PyPy is both faster and slower than CPython - faster when restricted to pure Python but slower than CPython using C extensions?
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by maxbond on Sunday September 27, 2020 @03:04AM (#24604817)
The PyPy website suggests this is the case.

https://www.pypy.org/features.html

> Our main executable comes with a Just-in-Time compiler. It is really fast in running most benchmarks—including very large and complicated Python applications, not just 10-liners.

> There are two cases that you should be aware where PyPy will not be able to speed up your code:

> Short-running processes: if it doesn't run for at least a few seconds, then the JIT compiler won't have enough time to warm up.

> If all the time is spent in run-time libraries (i.e. in C functions), and not actually running Python code, the JIT compiler will not help.

Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by moonchild on Sunday September 27, 2020 @03:35AM (#24604933)
Does it? It looks to me like it indicates performance will be the same when calling c functions.
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by gridlockd on Sunday September 27, 2020 @04:05AM (#24605043)
It depends on how the C functions are called. CPython extension modules either don't work or have high overhead.

CFFI-based modules should work without a big penalty, but these are generally slower than extension modules.

Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by globular-toast on Sunday September 27, 2020 @05:16AM (#24605310)
It depends on the code. You don't get speed for free by using C extensions with CPython. You have to write code specifically for that extension. To get significant speed benefits from numpy, for example, you need specific knowledge of numpy and the code produced will be completely different from regular Python. Pypy, on the other hand, is essentially a free speed boost when you have standard python code.
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by moonchild on Sunday September 27, 2020 @02:54AM (#24604771)
I've never heard of that.

What I have heard, though, is that string operations are more expensive in pypy than cpython.

Regardless, performance gains and regressions are unlikely to generalize; what's true for someone else's project may not be true for yours. If you're concerned about performance, I recommend benchmarking your own codebase.

Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by rincewind on Sunday September 27, 2020 @03:54AM (#24605012)
It's true. Source: I benchmarked some PyGame pixel pushing. HPy might alleviate that in the future, but C extensions need to switch to HPy for that.
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by uyt on Sunday September 27, 2020 @08:36AM (#24606182)
This innocent (albeit convoluted) piece of code used to segfault on pypy 7.3.1 . It is now fixed in this release! It was a bug in their JIT.

  def main(n):
    # Note: exact value of n and prints are significant, don't change
    a = [0] * n
    for _ in range(n):
        pos = -1
        for i in range(n):
            if i > 0:
                print(a[i - 1], end="")
                pos = i
        print(a[pos], _, n)
  main(191)
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by vkaku on Sunday September 27, 2020 @03:50AM (#24604996)
I really wish some python company invested money into making python 3.8+ compatible pypy, and running more tests on libraries for compatibility fixes. We could all use faster code.
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by pjmlp on Sunday September 27, 2020 @04:08AM (#24605051)
Agreed, otherwise there is always Julia or a Common Lisp to choose from, and they can easily have bindings for the same C++ and Fortran libraries.
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by scns on Sunday September 27, 2020 @04:46AM (#24605190)
Hm, why do i think it is funny you recommend Julia and CL in a thread about PyPy, while preferring Java to Clojure, Kotlin and Scala?
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by pjmlp on Sunday September 27, 2020 @05:57AM (#24605514)
Because 30+ years of experience have taught me to only use platform languages for production code.

Clojure, Kotlin and Scala are guests with temporary permit until the landlord acquires all features that matter to the masses, then they will join Beanshell and friends.

Julia and Common Lisp are the landlords of their own stacks.

As for the feature of the language themselves, I always considered myself polyglot, using the platform languages for each kind of deployment scenario.

Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by galfarragem on Sunday September 27, 2020 @01:13PM (#24608186)
And typescript? Is it better to stay away also?
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by pjmlp on Sunday September 27, 2020 @03:02PM (#24609258)
I only use Typescript where it is the platform, e.g. Angular.

With other Web frontend frameworks, I use straight JavaScript, and direct HTML tags without any build tool.

Also if I am responsible for the whole stack, I use the JavaScript minifiers from the SSR frameworks like JEE and ASP.NET.

Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by mdaniel on Sunday September 27, 2020 @02:25PM (#24608931)
Is that something PyPy would even accept patches for, or they haven't done it because it doesn't interest them?

I would hate for someone to do all that work only to end up with a fork

Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by vslira on Sunday September 27, 2020 @12:53PM (#24608028)
Great news! Congrats (and thank you) to the team!

Is there any chance for Pypy to work with Numba, especially with HPy coming? Yes, they're both JIT compilers, but I feel like the kind of optimizations they do are complementary rather than redundant. I want fast business logic with fast algorithmic code in the hot parts :)

Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by xvilka on Sunday September 27, 2020 @02:43AM (#24604707)
It became less relevant in the age of Julia language.
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by viraptor on Sunday September 27, 2020 @03:06AM (#24604829)
That's a weird claim without specifying the context. Julia doesn't run python code, so that's not it. It doesn't use python's programmers... etc.

Is it "for new code which is maths/vector heavy and not relying on any existing environment, Julia is a valid competitor to pypy"? Or is there a better qualifier?

Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by pjmlp on Sunday September 27, 2020 @04:11AM (#24605064)
On the contrary, Julia might be the kick on the Python world to finally start discussing about having something like PyPy as standard.
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by potatochup on Sunday September 27, 2020 @04:32AM (#24605131)
Eh, there are still huge legacy codebaes around that benefit from pypy, not everything is worth a rewrite
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by bunje on Sunday September 27, 2020 @11:06AM (#24607162)
Currently my greatest concern is the inability of Julia to provide stability even after they've reached 1.0. On paper 1.0 is a LTS release and still supported, but how many packages actually support it anymore? There seems to be no guidelines either, the official stance is that "we move on and drop LTS when the package developers move on."
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by ChrisRackauckas on Sunday September 27, 2020 @07:18PM (#24611043)
>but how many packages actually support it anymore?

99%? You won't get the most recent versions because a lot of packages started requiring v1.3 when the new AD and multhreading mechanisms came out, but you can still boot up the LTS and run any standard analysis that existed back when 1.0 was around, which is something like 3000+ packages. Where is your FUD coming from?

Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by deadmutex on Sunday September 27, 2020 @02:44AM (#24604719)
Do you have numbers to back this up?
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by ChrisRackauckas on Sunday September 27, 2020 @07:20AM (#24605820)
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by xvilka on Sunday September 27, 2020 @02:54AM (#24604765)
See https://lh3.github.io/2020/05/17/fast-high-level-programming...

Also I should note that Julia performance greatly improved since. Next week there should be the 1.6.0 release, which will have even better numbers.

Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by abdullahkhalids on Sunday September 27, 2020 @05:24AM (#24605356)
> I don’t see Julia a good replacement of Python. Julia has a long startup time. When you use a large package like Bio.jl, Julia may take 30 seconds to compile the code, longer than the actual running time of your scripts. You may not feel it is fast in practice. Actually in my benchmark, Julia is not really as fast as other languages, either. Probably my Julia implementations here will get most slaps. I have seen quite a few you-are-holding-the-phone-wrong type of responses from Julia supporters. Also importantly, the Julia developers do not value backward compatibility. There may be a python2-to-3 like transition in several years if they still hold their views by then. I wouldn’t take the risk.
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by BlackFingolfin on Sunday September 27, 2020 @06:01AM (#24605528)
I doubt that Julia 1.6.0 will be released next week. There were no rc (release candidates) not even an alpha or beta release.
Re:PyPy 7.3.2 triple release: Python 2.7, 3.6, and 3.7 by xvilka on Sunday September 27, 2020 @08:33AM (#24606166)
I probably messed up something, but I meant alpha, yes.