A drawback of using PyPy vs Python
Difference between en1 and en2, changed 129 character(s)
I always saw Python(CPython) as inferior to PyPy3, because of **SPEED** ↵

but today while working on a easy problem([problem:189A]) I found that I was getting repeated _Runtime Errors_. I tried to improve my code but my solution didn't got Accepted.↵

My (Runtime error) PyPy3 solution:↵
https://codeforces.com/contest/189/submission/86150951↵

after struggling for sometime, I thought I should give Python(CPython3) a try and submitted the same code in Python3. Voila!! I got AC immediately.↵

My (Accepted) Python3 solution:↵
https://codeforces.com/contest/189/submission/86150968↵

What was I doing wrong? I don't know clearly for now, but I can see that there is a huge difference in memory consumption of Python3(8952 KB) and PyPy3(24604 KB). Maybe my solution was taking too much memory in PyPy3 and that's why it got Runtime error.↵

I googled about it for few minutes and found a wonderful article explaining why PyPy3 consumes lot of memory:↵
[https://morepypy.blogspot.com/2013/10/incremental-garbage-collector-in-pypy.html](https://morepypy.blogspot.com/2013/10/incremental-garbage-collector-in-pypy.html) ↵

This article basically says: The main reason why PyPy is faster than CPython is that PyPy delays garbage collection. Please correct me if I am wrong.↵

I will try to replicate this in my local system and see what's happening. If get any new info, then I will add it here.↵

TLDR; UseTry Python when you are getting error with PyPy↵
-----------------------------------------------------↵

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English xordux 2020-07-06 22:13:07 129 Initial revision
en1 English xordux 2020-07-06 22:09:44 1427 Initial revision (published)