Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A good way to get folks to make the switch.

I just wish Python 3 didn't benchmark so much slower than Python 2 in some of my use cases (though I still aim for compatibility with it).

Couple of relevant search results:

http://stackoverflow.com/questions/14911122/same-code-slower...

http://pythonadventures.wordpress.com/2013/08/15/python-3-is...

Has anyone else experienced this?



Codechef appears to use Python 3.1.2 for "Python3", which is pretty old (March 21st, 2010) and predates some significant performance improvements in Python3[0].

[0]: E.g., 3.3 adds a more efficient encoding for ASCII-subset unicode strings: http://docs.python.org/3/whatsnew/3.3.html#performance-and-r...


I think readlines() is slower in python 3 due to unicode decoding. Python 2 did no decoding, readlines() returns python 2's str type, just bytes. You'd have to decode yourself (or decode the whole file in open()). Python 3 readlines() does decoding into unicode code points by default.

Do a benchmark after the file has been opened with an explicit encoding, to see if I'm right. If the files already been decoded, there shouldn't be as big a difference.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: