New issue 3071: pypy3 slows down simple reading from stdin
https://bitbucket.org/pypy/pypy/issues/3071/pypy3-slows-down-simple-reading-from-stdin
AliReza Mosajjal:
Hi,
I’m writing a wrapper for a C library which has a very fast stdin/stdout line
per second. Python 3.7.4 is a good option but I wanted to test my code against
pypy3 to see the performance optimizations and I was caught by surprise. pypy2
is outperforming Python \(as expected\) but pypy3 is surprisingly slow. Here’s
the simplest code snippet to test:
```python
import sys
if __name__ == "__main__":
for line in sys.stdin:
sys.stdout.write(line)
```
I ran this code against 4 different python versions \(python 2.7.15, python
3.7.4, pypy2 7.1.1, pypy3.6 7.1.1\). Here’s the results:
```
$ timeout 10 cat /dev/urandom | base64 | pypy stdin.py > pypy2.list
$ timeout 10 cat /dev/urandom | base64 | pypy3 stdin.py > pypy2.list
$ timeout 10 cat /dev/urandom | base64 | python stdin.py > python2.list
$ timeout 10 cat /dev/urandom | base64 | python3 stdin.py > python3.list
$ wc - l *.list
26053216 pypy2.list
6653260 pypy3.list
21715329 python2.list
21327765 python3.list
```
The machine is an Arch Linux with this pypy3:
```
Python 3.6.1 (784b254d669919c872a505b807db8462b6140973, May 09 2019, 13:17:30)
[PyPy 7.1.1-beta0 with GCC 8.3.0] on linux
```
so why do you think pypy3 is performing so bad compared to others?
Cheers,
_______________________________________________
pypy-issue mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-issue